How to show Page tree and hide other options in Sidebar by default for all Spaces
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
Summary
By default, the space sidebar shows Child Pages and a few other options, such as Pages, Blog, Calendars, Space 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
1 2 3 4 5 6
.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
1
{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.
Was this helpful?