Lego2012
7/11/2017 - 4:07 PM

Include the TOC conditionally

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.