Exclude Navigation on certain pages
Hello,
we don't want to display a navigation (within a DIV) on certain pages in the export. With Scroll Viewport I can easily exclude pages that contain certain labels.
#if(!$page.labels.contains("glossary") && !$page.labels.contains("nonav")) ... #end
This does not appear to be possible with the exporter. I only found out that I can exclude pages with certain titles.
#if(!$stringEscapeUtils.escapeHtml($element.Title).contains("News"))
How do I do this on basis of the labels?
Is there a complete list of all placeholders for the HTML Exporter?
Thanks & greetings,
Volker
-
Hi,
only to post my solution:
I created a simple user macro:
## @noparams
<p class="nonav"> </p>(Can't be a <div>. See https://k15t.zendesk.com/hc/en-us/community/posts/360038132832-Defining-Velocity-Templates)
Whenever this macro is on a page, this JS/JQuery in will remove the entire navigation div and its content.
if($('p.nonav').length > 0)
{
$("div#lis-nav-content" ).remove();
}Greetings,
Volker
-
Hi Volker,
Thanks for the post - was I right in thinking that you were wanting to exclude pages from the generated HTML export? If so, within the export options you can achieve this in your Export Scheme and/or prior to exporting.
Simply, select This page and all children with label … from the export dialogue (General tab) and then enter a space separated list of Confluence page labels (from the child pages you're exporting) in the opened field. To exclude certain labels, you would need to prepend the ^ character to the label. For example 'admin_guide ^draft' will include pages with label 'admin_guide' but not draft.
You also mentioned about placeholders in your message, and you can view the list of available placeholders for an export template here.
Cheers, Thomas (K15t)
-
Hi, Thomas,
I'm sorry, I was unclear in my second sentence. I don't want to exclude whole pages. It's about this: I built a navigation - or better: a table of contents - for a page within a DIV and inserted it into the template. But this TOC should not be displayed on certain pages. For Scroll Viewport I do this in the described way with an IF-condition: Pages with certain labels do not get a TOC. How do I define the condition for the exporter?
If there is another solution besides labels, that would be okay too. But I don't want to put my DIV as a user macro on the Confluence page itself.
In this context I come across entries in the community that have helped me (e.g. this comment). There I have the impression that not all placeholders and possibilities are described in the help. The placeholders may be complete. (I know the page of course.) I mean the variations I attach to $page for example $page.title, so $page.(Variation).
Greetings,
Volker
-
Hi Volker,
Thanks for your reply. I checked with our developers in relation to your request and it seems that it’s only possible to do a check like this for the root page (by checking $page.getLabels() ).
Currently it’s not possible to do a check like this for any child pages (except for checking against the page title which is not ideal). Therefore, I'm not sure we are able to offer a good solution for what you require.
Thanks, Thomas (K15t)
Please sign in to leave a comment.
Comments
6 comments