How to show Page tree and hide other options in Sidebar by default for all Spaces

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Purpose

By default, the space sidebar shows Child Pages and a few other options, such as PagesBlogCalendarsSpace Shortcut, and Space Shortcuts.

If a user or space admin wants to show the Page Tree and hide the other options, they will have to go to each space and change it manually.

Solution

  • We can instead use CSS to hide the links that we do not want by default
  • Use the Page Tree macro to add a Page Tree to the sidebar instead.

Steps

  • To hide the other default options from the sidebar
  • Add the CSS below in the Global Stylesheet (Confluence_BaseURL)/admin/viewstylesheet.action

    .main-links-section {display: none;
    }
    .quick-links-wrapper {display: none;
    }
    .ia-secondary-container.tipsy-enabled {display: none;
    }
  • To show the Page Tree, we use the macro in the Sidebar, header, and footer section

    {pagetree:sort=natural|excerpt=true|reverse=false|startDepth=3|expandCollapseAll=true|searchBox=true}
  • The result would be something like below, for all Spaces.


We can further configure the Page Tree macro to hide the search box and the other options like sort, depth, and show or hide the expand, collapse all option.



Last modified on Jan 6, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.