# How to omit specific heading from TOC?

**URL:** <https://zola.discourse.group/t/how-to-omit-specific-heading-from-toc/1883>\
**Category:** Uncategorized\
**Created:** [September 26, 2023, 4:29pm UTC](https://zola.discourse.group/t/how-to-omit-specific-heading-from-toc/1883 "2023-09-26T16:29:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![flyingcakes](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/flyingcakes/32/1092_2.png) [@flyingcakes](https://zola.discourse.group/u/flyingcakes)\
**Post date:** [September 26, 2023, 4:29pm UTC](https://zola.discourse.group/t/how-to-omit-specific-heading-from-toc/1883/1 "2023-09-26T16:29:16Z")

</div>

I have a separate heading at end of my post for `Further reading`, which I don’t want to show up in the TOC.

The heading is normally defined with markdown as level 4 heading

```md
#### Further reading

content...

```

Presently, the heading shows up in my TOC normally like other headings. I don’t expect that behaviour since my TOC template code is supposed to show only 2 levels of headings. (I might be wrong with this part)

In LaTeX, I can omit a specific heading from TOC by using aesterix (eg `\section*{Further reading}`)

Is something similar possible with Zola?

> **TOC template code from page.html**
>
> ```html
> {% if page.toc %}
> <a onclick="toggle('toc-custom')">Toggle table of contents</a>
> <div id="toc-custom" style="display:none">
> <h3>Contents</h3>
> <ul>
> {% for h1 in page.toc %}
> <li>
> <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
> {% if h1.children %}
> <ul>
> {% for h2 in h1.children %}
> <li>
> <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
> </li>
> {% endfor %}
> </ul>
> {% endif %}
> </li>
> {% endfor %}
> </ul>
> </div>
> <hr>
> {% endif %}
> 
> ```

---

<div class="post-metadata">

**Author:** ![flyingcakes](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/flyingcakes/32/1092_2.png) [@flyingcakes](https://zola.discourse.group/u/flyingcakes)\
**Post date:** [September 26, 2023, 5:24pm UTC](https://zola.discourse.group/t/how-to-omit-specific-heading-from-toc/1883/2 "2023-09-26T17:24:18Z")

</div>

> [@flyingcakes](#):
>
> The heading is normally defined with markdown as level 4 heading
> 
> ```auto
> #### Further reading
> 
> content...
> 
> ```

Playing around, I discover that using HTML doesn’t show up the heading in TOC.

```html
<h4>Further reading</h4>

```

Not sure if this is the way Zola intends this to be achieved though.

---

<div class="post-metadata">

**Author:** ![welpo](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/welpo/32/1087_2.png) [@welpo](https://zola.discourse.group/u/welpo)\
**Post date:** [October 2, 2023, 11:18am UTC](https://zola.discourse.group/t/how-to-omit-specific-heading-from-toc/1883/3 "2023-10-02T11:18:45Z")

</div>

> [@flyingcakes](#):
>
> my TOC template code is supposed to show only 2 levels of headings

It’s not about their actual HTML tag, but rather their level. So you can’t just add more `#` to hide a heading. If your Further Reading section were nested within two levels, then it would be hidden.

Regarding your actual question, yes, it’s possible, with a bit of work.

For my theme, I wrote a table of contents macro that checks for an “ignore pattern”. See the code [here](https://github.com/welpo/tabi/blob/main/templates/macros/table_of_contents.html).

Basically, before rendering a heading, it checks if it matches a Regex set at the page level, on the post’s front matter.

For your specific use case, you’d set the ignore pattern like:

```markdown
+++
title = "Your Post's Title"
date = 2023-10-02

[extra]
toc_ignore_pattern = "^(Further reading)"
+++

```

Hope that helps!
