Skip to end of metadata
Go to start of metadata

Hi!
How can i display all pages of a space in the menu?

  • No labels

4 Comments

  1. We would strongly reccomend against doing this since it is likely to cause performance problems (each page will need it's view permission checked on every page view), however the code would be:

    {menubar}
      {menu}Pages
        {wikimenu}{children:depth=all}{wikimenu}
      {menu}
    {menubar}
    

    You can work around some of the performance problems that this code will cause by caching the result of the children macro, eg:

    {menubar}
      {menu}Pages
        {wikimenu}{cache:refresh=1d}{children:depth=all}{cache}{wikimenu}
      {menu}
    {menubar}
    

    However you will still be downloading a lot of extra data with each page view, and the menu will be difficult to navigate as your site grows.

    You may be better off using a {pagetree2} in your layout instead:

    {pagetree2}
    

    eg:

    Unable to render content due to system error: java.lang.ClassCastException: com.adaptavist.confluence.theme.engine.macros.deprecated.Pagetree2Macro cannot be cast to com.atlassian.renderer.v2.macro.Macro
    1. Unknown User (bonder)

      Hi! Thanks for your reply.
      The 1st and 2nd code didn't work... :/
      I want something like

      {pagetree2}

      but in the top menu.
      I almost did it with this

      {children:sort=creation|page=Home|depth=2}

      but Home hasn't shown. I want to start display from the space's root.

      1. Unknown User (bonder)

        I did it with

        {children:sort=creation|page=space-name:|depth=2}
        1. As your wiki expands the site will grind to a halt ... I strongly urge you to look for another solution, or this will come back to haunt you at some point in the future (most likely when there are a million other things that need your attention and fixing this one is the last thing you needed - Murphy's Law)