{{ define "li" -}} {{ $s := .section -}} {{ $p := .page -}} {{ $treeRoot := cond (eq .ulNr 0) true false -}} {{ $ulNr := .ulNr -}} {{ $ulShow := .ulShow -}} {{ $active := eq $s $p -}} {{ $activePath := $p.IsDescendant $s -}} {{ $show := cond (or (lt $ulNr $ulShow) $activePath (eq $s.Parent $p.Parent) (eq $s.Parent $p) ($p.IsDescendant $s.Parent)) true false -}} {{ $pages := (union $s.Pages $s.Sections).ByWeight -}} {{ $withChild := gt (len $pages) 0 -}} {{ $rootDir := lt $ulNr 1 -}} {{ if and $show (not (default false $s.Params.hidden)) }}
  • {{ $s.LinkTitle }} {{ if and $ulNr $withChild }} {{ if or $active $activePath }} {{/* TODO: why can't I add the rotate-%s class? */}} {{ partial "icons/docs-nested-section" (dict "class" "shrink-0 h-[1.0rem] w-[1.0rem] stroke-slate-400 rotate-90") }} {{ else }} {{ partial "icons/docs-nested-section" (dict "class" "shrink-0 h-[1.0rem] w-[1.0rem] stroke-slate-400") }} {{ end }} {{ end }} {{- if $withChild }} {{- $ulNr := add $ulNr 1 }} {{- end }}
  • {{- end }} {{- end }} {{ $ancestors := .Ancestors.Reverse }} {{ $sectionRoot := index $ancestors 2 }} {{ $navRoot := cond (eq $sectionRoot nil) . $sectionRoot -}}