Include the TOC conditionally
Edit the file single.html
again, and replace the earlier entry with:
{{ if .Params.toc }}
{{ .TableOfContents }}
{{ end }}
Now on the pages we want a TOC, add the following to the front matter:
---
...
toc: true
...
---
Ta-da! Optional TOC for your Hugo pages.