{{- $showvisitedlinks := .Site.Params.showVisitedLinks }} {{- define "section-tree-nav" }} {{- $currentNode := .currentnode }} {{- $showvisitedlinks := .showvisitedlinks }} {{- $alwaysopen := .alwaysopen }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- with .sect }} {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} {{- $isActive := $isSelf }} {{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- if $hidden }} {{- else }} {{- $numberOfVisibleChildren := 0 }} {{- range $pages }} {{- $isSelfSub := eq .RelPermalink $currentFileRelPermalink }} {{- $isAncestorSub := and (not $isSelf) (.IsAncestor $currentNode) }} {{- $relearnIsSubHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not $isSelfSub) (not $isAncestorSub) }} {{- $numberOfVisibleChildren = add $numberOfVisibleChildren (int (not $subHidden)) }} {{- end }} {{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }} {{- $url := partial "permalink.gotmpl" (dict "to" .) }} {{- safeHTML .Params.head }} {{- if $numberOfVisibleChildren }} {{- $isCollapsible := or (.Params.collapsibleMenu | default .Site.Params.collapsibleMenu) (not $url) }} {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }} {{- $pageHash := md5 .Page }} {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}