Skip to main content
Background

TOC Disable Example

·1 min
This page demonstrates how to disable the table of contents in markdown files.

How to Disable TOC #

To disable the table of contents in any markdown file (including index.md files), simply add the disableToc: true parameter to the front matter:

---
title: "Your Page Title"
description: "Your page description"
disableToc: true  # This disables the TOC
---

Usage Examples #

For Individual Pages #

Add disableToc: true to the front matter of any markdown file to disable the TOC for that specific page.

For Index Pages #

For index.md files that serve as list pages, you can also use the cascade parameter to apply the setting to all pages in that section:

---
title: "Section Title"
cascade:
  disableToc: true  # Disables TOC for all pages in this section
---

How It Works #

When disableToc: true is set:

  1. The table of contents will not be displayed on the page
  2. The TOC JavaScript will not be loaded (improving performance)
  3. The TOC highlighting functionality will be disabled

Note #

This feature works for both:

  • Individual article pages (using the single.html template)
  • List/index pages (using the list.html template)

The TOC will still be generated by Hugo, but it won’t be displayed or have JavaScript functionality when disabled.