How do you exclude specific headings from a TOC?

Efleda Brophy
Contributor
November 29, 2022

I want to exclude all Heading 5 text from the TOC.

These settings do not work:
min=3, max=6, exclude=5 (preview: includes all H5 text)
min=3, max=4, include=6 (preview: blank TOC)

2 answers

1 accepted

0 votes
Answer accepted
Andy Gladstone
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2022

@Efleda Brophy in the include and exclude you need to put the text that is in the heading, not the heading number.

In your example you are trying to exclude Heading 5. In order to do that you will need to insert the text contained in that heading in the macro parameters.

Also, if you set the min to 3 and max to 4, no matter what appears in header 6 you cannot include it since the first parameter (min/max) would override the second one (include 6). 

The documentation for the ToC Macro can be found here:

https://support.atlassian.com/confluence-cloud/docs/insert-the-table-of-contents-macro/

I hope this helps!

Efleda Brophy
Contributor
November 29, 2022

@Andy Gladstone Thank you. I was hoping it would be simpler than having to type all H5 text.

I tried this solution using the default delimiter (brackets). This is what Exclude Headings text box contains: [AUTHOR(S)][DATE CREATED OR UPDATED:][STATUS][TECHNICAL OWNER][APPROVER(S)][DATE APPROVED:][AUDIENCE][PURPOSE][OVERVIEW][DETAILS]

 

Preview or Publication still displays all text with (listed under Exclude Headings) in the TOC. 

What am I missing?

0 votes
Nic Brough -Adaptavist-
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.
November 29, 2022

The include/exclude work off regular expressions, so what I would do with your settings is

  • Minimum: 3
  • Maximum: 7
  • Exclude:  <regex for header 5>

Problem is I'm rubbish at Regex, I'm not sure what to actually write there.

Efleda Brophy
Contributor
November 29, 2022

Thanks for trying to help...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events