Skip to main content
NiCE CXone Mpower Expert
Expert Success Center

Hide certain headings in the TOC

Applies to:
All versions
Role required:
Draft Contributor

The table of contents (TOC) is generated dynamically from the heading elements in your content. Headings are nested hierarchically, so hiding a heading level from the TOC will also hide every level below it. This means you cannot hide a single heading level in isolation. For example, if your page uses H2, H3, H4, and H5, you cannot hide only H4 while keeping H5 visible.

If you are using headings to control how text looks rather than to define content sections, consider keeping headings in their correct semantic order and applying custom CSS to change their appearance instead. Semantic heading order (H2, then H3, then H4) is important for accessibility and SEO, and it keeps your TOC accurate.

If your headings follow the correct order and you still want to hide certain levels from the TOC, you can do so with CSS.

To hide heading levels from the TOC:

  1. Open your page in Edit mode.
  2. In the editor, click Styles and select CSS from the drop-down menu.

Step 2 adds a blue CSS box to the page that is only visible when the page is opened in Edit mode.

  1. Paste the following code into the CSS box. Choose the snippet that matches the heading levels you want to hide:
/* HIDE H4, H5 & H6 FROM TOC */
#mt-toc-container li li li {
    display:none;
}
/* HIDE H5 & H6 FROM TOC */
#mt-toc-container li li li li {
    display:none;
}
/* HIDE H6 FROM TOC */
#mt-toc-container li li li li li {
    display:none;
}

Each li in the selector represents one heading level in the TOC hierarchy. The first li corresponds to H2, the second to H3, and so on. Because the TOC nests headings inside one another, hiding a level will also hide all levels below it.

You can apply the code site-wide or to an individual page. If you want to apply the code site-wide, apply the CSS in Control Panel > Custom Site CSS.

 

  • Was this article helpful?