Table Of Contents (TOC) in Hugo

Page content

Enabling TOC

Here is the official document about TOC.

When you want to enabling TOC feature in Hugo, add the following line in config.toml. Then, TOC will enabled at all posts.

[Params]
...
  toc = true
...

Configure TOC

Here is the official document about TOC configurations.

I don’t need to configure it detail enough, added the disription in config.toml.

[markup]
  [markup.tableOfContents]
    startLevel = 2
    endLevel = 4
    ordered = false
  • startLevel = 1: List to the TOC from #.
  • startLevel = 3: List to the TOC to ####.