Create a table of contents on the top page that includes TOCs from child pages?

Mark Robinson September 26, 2017


I'd like a macro similar to the standard table of content that as the option to include all the child pages table of contents too.. Therefore when exporting to PDF the top page and lower pages the top page includes the full table of contents similar to any word document. I understand its best to create pages like chapters of a book (child pages) and top page is the table of contents for the whole book and a short introduction (prologue) to the book itself. 

Ideally if at all possible to be able to number the headings too option would be the icing on the cake,



7 answers

2 accepted

11 votes
Answer accepted
Davin Studer
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.
September 26, 2017

To build upon the answer that @Peter DeWitt gave ...

On your parent page add the "Children Display" macro with the "Excerpt Display" option set to rich content.

Then on your child pages add an Excerpt macro at the top and inside that macro add a Table of Contents macro and set the options of the TOC macro like this ...

  • Outpust Type - list
  • List Style - disc
  • Minimum Heading Level - 1
  • Maximum Heading Level - 6
  • Printable - checked
  • Absolute URL - checked

Then on your child pages simply put in your content. You parent page will show the child pages and their TOC's in a tree format.

Daniel Verberne January 11, 2021

Hello, I'm aware your post was made several years back, but I'm trying to implement this now and I'm unsure how many 'child pages' I need to tackle to apply the Excerpt Macro with the Table of Contents macro inside it?

I've got an existing Confluence space many pages in size and depth and not sure how much manual work will be required for the expected result.

Kimberly Onnen January 12, 2021

Hi Daniel, you would need to put the "Children Display" macro inside the "Excerpt" macro for the parent page of the sub-topics that you want to include on the main table of contents. 

In the example below, topics "A" and "B" are first-level topics with multiple child topics (SubA1, SubA2, etc.). Some of those topics have child topics (SubA2-1, SubA2-2) and some of those topics have child topics (SubA2-3-1, SubA2-3-1).

If you want the child topics to be included in your table of contents, then their immediate parent topic needs the Excerpt with the Children Display inside that. BUT.. keep in mind that a topic can only have ONE instance of the Excerpt macro.  I ran into a problem with this because I use Excerpt a lot.

A (excerpt with Children Display)


-SubA2 (excerpt with Children Display)



  --SubA2-3 (excerpt with Children Display)


    ---SubA2-3-2 (excerpt with Children Display)





B (excerpt with Children Display)



-SubB3 (excerpt with Children Display)



Mira August 10, 2021

Also aware that this post was made several years ago, but it appears that a recent update introduced a bug where this solution is no longer viable. Putting a Table of Contents macro inside an Excerpt macro on the child pages makes the Table of Contents invisible, and it won't show up on the parent page in the Excerpt Include macro either.

Any other ideas?

Michael Capobianco
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!
October 19, 2021

Hey, Mira

My workaround for this was to create two table of content sections. One in the excerpt (that will show on the parent page) and one outside of it  (that will show on the leaf page)

0 votes
Answer accepted
Peter DeWitt
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 26, 2017

Mark, trying using a combination of the Excerpt / Excerpt Include Macros.  You can wrap the ToC on the child pages in an Excerpt and display them in the parent page using the Excerpt Include.



2 votes
Kimberly Onnen July 19, 2018

I know this is almost a year old, but this solved an issue I was having!! Due to the nature of my space (installation, configuration, etc.), I didn't want my pages broken out into child pages to make it easier for a user but I also wanted a table of contents. Once I removed the Surrounding Panel, this worked exactly as I wanted. I had to add links to my three pages and underneath each link, I included the ToC from within each page. 

Thanks for asking the question and thanks for the answers!!

2 votes
Mark Robinson September 29, 2017

Worked a treat thanks alot Mark

0 votes
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 27, 2023

Thank you, the nested macros worked perfectly.

0 votes
Lukas Gotter _ Meetical
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 6, 2023

Please vote for this issue to bring the "include TOC from an excerpt" feature back

0 votes
Arseny Poltorak
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!
June 5, 2021

I've answered similar question in this topic. It's pretty much the same recipe as Davin suggested, just explained in greater detail with a screenshot and a suggestion, how to keep your children pages free of TOC, while still having the TOC on the parent page.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events