Published on Feb 25, 2021

How to exclude certain Headings from Oxygen’s Table Of Contents

Sridhar Katakam

Oxygen‘s Table Of Contents composite element scans for and lists all the h2, h3, h4, h5 and h6 headings in the TOC on the page out of the box.

If you are looking to exclude certain headings from it, we can use the jQuery not() method like this.

In the TOC Code code block edit the JavaScript and change

jQuery('h2,h3,h4,h5,h6').each( function() {

to

jQuery('h2,h3,h4,h5,h6').not('#headline-1096-44, #headline-1100-44').each( function() {

where #headline-1096-44 and #headline-1100-44 are the selectors of headings that should not be included.

If you have a number of headings on a page that you want to exclude from Oxygen’s Table Of Contents, you could assign a class of say, not-in-toc to each of them and change the line to

jQuery('h2,h3,h4,h5,h6').not('.not-in-toc').each( function() {

Reference

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right