Exclude Navigation on certain pages

Comments

6 comments

  • Avatar
    Volker Weinreich

    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

    1
    Comment actions Permalink
  • Avatar
    Thomas Rough (K15t)

    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)

    0
    Comment actions Permalink
  • Avatar
    Volker Weinreich

    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

    0
    Comment actions Permalink
  • Avatar
    Thomas Rough (K15t)

    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)

     

     

    0
    Comment actions Permalink
  • Avatar
    Volker Weinreich

    Hi Thomas,

    okay, thanks. Then I'll see how I can best solve it.

    Greetings,

    Volker

    0
    Comment actions Permalink
  • Avatar
    Thomas Rough (K15t)

    Hi Volker, thanks for the post.

    We appreciate that you have made your user-macro solution public for the benefit of others that may have the same question.

    Cheers, Thomas (K15t)

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk