How do I Exclude multiple Headings or an entire section?

Allie Serious March 4, 2016

This question is in reference to Atlassian Documentation: Table of Contents Macro

I have 2 table of content zones and a main table of content, I dont want the 2 zones to show in the main.  I tried using 2 words to exclude but since it is looking at both as one word neither get excluded.  I cant make a 3rd zone because what I am trying to exclude is in the middle of the page. 

2 answers

1 vote
Andy J.
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 2016

Hi Allie,

I tried mimicking your setup and was able to exclude the Table of Content Zones using the *Exclude Headings* function in the Table of Contents macro. This part may be a bit confusing as the parameter takes regular expressions to find matches and exclude them.

One useful tool to make sure the regular expression you created catches the sections you want is the following: http://www.regexpal.com/ This should let you test your regular expressions to make sure they are valid.

As an example, I created some Table of Content Zones with the names ZONE and SECTION respectively. I then created a simple regular expression to capture both of the words and added it to the Exclude parameter:

ZONE|SECTION

This should exclude any words in the regex statement above from the Table of Contents macro and you should be able to add more complex filters to the expression to come up with any patterns you like. The site I provided above has some cheat sheets on how to come up with valid regular expressions and should help if the simple command above does not work for you (in your case you should be able to edit the command above to fit your zone names).

Regards,

Andy Jean
Confluence/Crowd Support

0 votes
Paz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2016

I think your use case might be too advanced for the out-of-the-box functionality of the TOC/TOC Zone macros.

 

=(

Allie Serious March 8, 2016

Wow, seems so crazy they have an include and exclude box and it only works with 1 word, I just need 2 words in there and exclude both... Thanks for the reply. 

Paz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 2016

Check Andy Jean's answer above. Perhaps your regexpression just needed to be improved.

shilpa shilpa September 8, 2020

Hello,

I have a similar situation where I have included a page in confluence using Include page macro but it has a toc of its own and I don't want to display it in my page. I tried using Exclude toc:, but it removes only the heading that we add in the exclude block. Is there a way to remove the entire toc section from my page? I wanted to use regex, but couldn't understand it correctly. Can anyone help please? Thanks.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events