{{- $currentNode := . }} {{- $showvisitedlinks := .Site.Params.showVisitedLinks -}} {{- if eq .Site.Params.ordersectionsby "title"}} {{- range .Site.Sections.ByTitle}} {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}} {{- end}} {{- else}} {{- if .Site.Home.Sections}} {{- .Scratch.Set "pages" (.Site.Home.RegularPages | union .Site.Home.Sections) }} {{- else -}} {{- .Scratch.Set "pages" .Site.Home.RegularPages }} {{- end}} {{- $pages := (.Scratch.Get "pages") }} {{- range $pages.ByWeight}} {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}} {{- end}} {{- end}} {{- define "section-tree-nav" }} {{- $showvisitedlinks := .showvisitedlinks }} {{- $currentNode := .currentnode }} {{- with .sect}} {{- if and .IsSection (or (not .Params.hidden) $.showhidden)}} {{- $numberOfPages := (add (len .Pages) (len .Sections)) }} {{- safeHTML .Params.head}} {{- else}} {{- if not .Params.Hidden }} {{- end}} {{- end}} {{- end}} {{- end}}