Is there a way to add a Page navigation tree (based on headings in the page) to the left side bar?

Steven Higgs
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 8, 2018

Basically, I have a very large document (page) and instead of displaying its table of contents at the top of the page, I want to display a navigation tree in the left side bar based on the same criteria that generates the table of contents within the page (for example, if it finds a heading 1 then it adds to the tree).

But I want this to be in the left side panel without creating a page for each heading.

Is this possible?

2 answers

5 votes
Igor M.
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2018

Hello,

You can add TOC macro to your sidebar same way you would to your page, but using Markdown language. 

For the example below, I went Space Tools > Look and Feel > Sidebar, header and footer and added the following markup to Sidebar section

{toc:style=none|outline=true|indent=10px|absoluteUrl=true|maxLevel=3}

It created TOC in the sidebar for the page that is currently open. From the language:

  • No bullet style was used
  • Pages were numbered by headings
  • The tree is indented by 10 pixels
  • Absolute URLs are used so that you are redirected to the page anchor, otherwise, links will not work
  • And I have chosen to show up to level 3 of pages

Any other parameters can be added by referencing Table of Contents Macro page.

So my final result was a table of contents shown in the sidebar. Every time I switch a page, TOC for that page will be displayed.

Screen Shot 2018-09-10 at 11.39.10.png

James Dellow
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 10, 2018

It would probably be worth creating a user macro to add some styling and javascript to make the TOC expandable

Steven Higgs
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 17, 2018

Igor,

Thank you for your suggestion. It does add the type of TOC we want to the sidebar, but whenever you click one of the links (in this TOC), it refreshes the whole page, collapses the new TOC, and the focus goes back to the document link (rather than the section where we're trying to link to.)

Any suggestions?

jychang
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 13, 2021

I want to try this, but there no longer appears to be a sidebar section Confluence Cloud 1000.0.0-da503df1a09f.

I tried Space Settings > Look and feel > Page layout, but only Header and Footer sections exist under Page layout.  Then I searched in Jump to setting... and found Space Settings > Manage Space > Edit sidebar, but there are only two toggle buttons for Overview and Blog and no section to enter markup.

How do I add the TOC to the Sidebar in Confluence Cloud 1000.0.0-da503df1a09f?

Like # people like this
0 votes
James Dellow
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 10, 2018

Another approach might be to make use of sticky table headers, by putting the TOC in the table header and the content in the table rows beneath, then use the flat list option in the TOC macro. However, this will only work in certain scenarios.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events