TableOfContents allows setting endLevel site-wide. How can I change the endLevel only for a particular post? I tried adding the following to the front matter but it doesn’t seem to do anything:
Use .Page.Param to check for custom params in front matter, falling back to custom params in your site configuration, falling back to default values as shown in the partial below.
layouts/partials/toc.html
{{ if .Params.toc }}
{{ $startLevel := or (.Param "toc.startLevel") 2 }}
{{ $endLevel := or (.Param "toc.endLevel") 3 }}
{{ $ordered := or (.Param "toc.ordered") false }}
{{ .Fragments.ToHTML $startLevel $endLevel $ordered }}
{{ end }}
The above requires v0.139.4 or later. See Issue #13107.