{{- $showvisitedlinks := .Site.Params.showVisitedLinks }} {{- $format := partial "get-format.hugo" . }} {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $basename := "index" }} {{- if ne $outputFormat "html" }} {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} {{- end }} {{- 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 := .Pages }} {{- if .Page.IsHome }} {{- $pages = .Sections }} {{- else if .Page.Sections}} {{- $pages = (.Pages | union .Sections) }} {{- end }} {{- $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 }} {{- safeHTML .Params.head }} {{- if $numberOfVisibleChildren }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }} {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }} {{- $pageHash := md5 .Page }} {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}