Generating Table of Contents on a parent page (for contents captured on child pages)

B Patel August 2, 2021

Hello:

Currently have one very long page on Confluence and it is now become difficult to maintain, find info, etc. for readers and the editor. This page has a Table of Contents (TOC) at the top of the page now.

We are thinking of taking good part of the contents from this page and move them into multiple child pages created under the main page. So it would be something like the following afterwards:

Product XYZ  (aka main page; parent page)
   --  Supported functionality  (aka subpage; child page)
   --  Pricing
   --  Service agreement
   --  Compliance
   --  etc.

Now we still want the TOC at the top of the main page (i.e., parent page) for contents included in the subpages. Assuming once the TOC is generated, if a user is to click on a link (say for Pricing), the user would be redirected directly to the "Pricing" subpage.

Does anyone know how one go about creating the TOC on the main page which would support the contents on the child pages?

Thanks.

2 answers

2 votes
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 2, 2021

The lefthand page navigation is not an option? 

If you just need links to pages, you can use the children-display-macro 

Or are you wanting to display links to headings on the child pages in the ToC?

B Patel August 2, 2021

Hello Bill,
I am not sure what you mean "lefthand page navigation."

I want links to various sections / sub-section headings from the child pages to be included as part of the Table of Contents on the main page.
Thanks.

Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 2, 2021

I am referring to the navigation pane on the left, AKA Space navigation sidebar.

I would think you can make what @Svenja Lorenzen has suggested work. If you were NOT on Cloud, I would propose writing a user macro, but that's out.

My suggestion is to just think outside the box a bit and just have a ToC on each page, and use the childred display macro on the top-level page (look at how Atlassian structures their documentation). Save yourself a lot of effort implementing somthing that few users will really use.

All to often, we try to replicate a printed doc structure in Confluence, but that does not make best use of a Wiki. 

Werner
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!
November 29, 2023

I found this helpful. It worked 100% with the On-Premise version of the platform.

0 votes
Svenja Lorenzen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 2, 2021

Hi @B Patel,

you could put a "Table of Content (TOC)"-macro on every page and include all TOCs via Excerpt Include.

Try the following

  1. On your new page - for example Pricing - place the "Excerpt"-macro.
  2. Place the TOC-macro inside the "Excerpt"-macro.
  3. On your main page - Product XYZ - place the "Excerpt Include"-macro.
  4. Enter the page name - in this example you want to display the excerpt from the page "Pricing"

Repeat this with the other pages and you should have a fully linked TOC of all pages with all headings.

Kinds regards,

Svenja

B Patel August 2, 2021

Hello Svenja:
Thanks for your help and reply.
I tried to follow the instructions and it seems that it creates multiple separate TOCs as shown below. Is there no way to create one single TOC -- comprised of all parent and child pages? Thanks.

SNIP capture.JPG

Benjamin Payet January 21, 2022

Hi, how did you manage to put a TOC macro inside an excerpt? When I try on my side, it doesn't work, the TOC is empty.

Like Stefanie Clesle likes this
Addie Hutchins March 23, 2022

Same - my TOC is empty inside the excerpt macro. Please advise @Svenja Lorenzen 

Antony Quinn May 4, 2022

this worked perfectly for me.  Created a excerpt on the child pages, dropped in the TOC macro.  Went to the parent page and created 3 excerpt include macros (I've got 3 child pages) and removed the surrounding panel.  It pretty much looks like a single TOC at the top of the parent page now with TOC within each child page for that specific page

Like Hanley, Brendan likes this
Giorgio Nunzi
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!
July 11, 2023

It does not work anymore, see Using Table of Contents with Excerpt/Excerpt-Inclu... (atlassian.com).

We designed the Table of Contents macro to only work within the page, blog or macro it has been inserted. It cannot reference or be referenced across multiple pages or blogs, meaning that when it is added to an Excerpt macro, it will only display headings located inside the excerpt. Those heading links won't navigate to the source page.

Basically there is no solution until they re-design the toc macro.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events