{{/* Parse toc.yaml and store the resulting map to $scratch */}} {{ $scratch := partialCached "utils/tocparser.html" . . }} {{ $ctx := . }} {{/* Get the name of the first section */}} {{ $firstSection := (index ($scratch.GetSortedMapValues "sections") 0).title }} {{/* Render the top-nav in sidebar for small screens */}} {{ if $firstSection }}
{{ end }} {{/* Recursive template for sidebar items */}} {{ define "tocRender" }} {{ $ctx := .ctx }} {{ if .entry.sectiontitle }} {{/* .entry is a section */}}
  • {{ else }} {{/* .entry is a page */}} {{ $isCurrent := eq (urls.Parse $ctx.Permalink).Path .entry.path }} {{ end }} {{ end }}