Table of Contents
Something that tripped me up here is that Hugo’s Table of Contents, done via goldmark, refers to that page, not the site.
How to program a recursive directory listing
Since Hugo’s parameter name is Sections, I may as well use HTML’s section as the name of the partial.
{{ template "filepath" (dict "path" "/content") }}
{{ define "filepath" }}
{{ $path := .path }}
<ol>
{{ range readDir $path }}
{{ if .IsDir }}
{{ template "filepath" (dict "path" (printf "%s/%s" $path .Name)) }}
{{ else }}
<li>{{ .Name }}</li>
{{ end }}
{{ end }}
</ol>
{{ end }}
partials/pagination.html
partials/menu/open-menu.html
partials/menu/slide-menu.html
hugo-theme-techdoc/layouts/partials/table-of-contents.html
{{ if .Params.TableOfContents }}
<aside class="table_of_contents">
<h5>Table of Contents</h5>
{{- .TableOfContents -}}
</aside>
{{ end }}