github.com/square/finch@v0.0.0-20240412205204-6530c03e2b96/docs/themes/hugo-geekdoc/layouts/shortcodes/toc-tree.html (about) 1 {{- $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }} 2 3 {{- if $tocLevels }} 4 <div class="gdoc-toc gdoc-toc__level--{{ $tocLevels }}"> 5 {{ template "toc-tree" dict "sect" .Page.Pages }} 6 </div> 7 {{- end }} 8 9 10 <!-- templates --> 11 {{- define "toc-tree" }} 12 <ul> 13 {{- range .sect.GroupBy "Weight" }} 14 {{- range .ByTitle }} 15 {{- if or (not .Params.GeekdocHidden) (not (default true .Params.GeekdocHiddenTocTree)) }} 16 <li> 17 {{- if or .Content .Params.GeekdocFlatSection }} 18 <span> 19 <a href="{{ .RelPermalink }}" class="gdoc-toc__entry"> 20 {{- partial "utils/title" . }}{{ with .Params.GeekdocDescription }}:{{ end }} 21 </a> 22 {{- with .Params.GeekdocDescription }}{{ . }}{{ end }} 23 </span> 24 {{- else -}} 25 <span> 26 {{- partial "utils/title" . }}{{ with .Params.GeekdocDescription }}: {{ . }}{{ end }} 27 </span> 28 {{- end -}} 29 30 {{- $numberOfPages := (add (len .Pages) (len .Sections)) }} 31 {{- if and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }} 32 {{- template "toc-tree" dict "sect" .Pages }} 33 {{- end }} 34 </li> 35 {{- end }} 36 {{- end }} 37 {{- end }} 38 </ul> 39 {{- end }}