docs/layouts/partials/sidebar-tree.html
{{ $context := .context -}} {{ $sidebarRoot := .sidebarRoot -}} {{ $sidebarRootID := .sidebarRootID -}} {{ $cacheSidebar := .cacheSidebar -}} {{ with $context -}} {{/* When the sidebar is cached, "active" class is set client side. */ -}} {{ $shouldDelayActive := $cacheSidebar -}}
{{ if not .Site.Params.ui.sidebar_search_disable -}} {{ partial "search-input.html" . }} {{- else -}} {{ partial "search-input.html" . }}
{{- end }} {{/* */ -}} {{- end }}{{/* with $context */ -}} {{ define "section-tree-nav-section" -}} {{/* cSpell:ignore manuallink manuallinkrelref manuallinktitle */ -}} {{ $s := .section -}} {{ $p := .page -}} {{ $shouldDelayActive := .shouldDelayActive -}} {{ $sidebarMenuTruncate := .sidebarMenuTruncate -}} {{ $treeRoot := cond (eq .ulNr 0) true false -}} {{ $ulNr := .ulNr -}} {{ $ulShow := .ulShow -}} {{ $active := and (not $shouldDelayActive) (eq $s $p) -}} {{ $activePath := and (not $shouldDelayActive) (or (eq $p $s) ($p.IsDescendant $s)) -}} {{ $show := cond (or (lt $ulNr $ulShow) $activePath (and (not $shouldDelayActive) (eq $s.Parent $p.Parent)) (and (not $shouldDelayActive) (eq $s.Parent $p)) (not $p.Site.Params.ui.sidebar_menu_compact) (and (not $shouldDelayActive) ($p.IsDescendant $s.Parent)) ) true false -}} {{ $mid := printf "m-%s" ($s.RelPermalink | anchorize) -}} {{ $pages_tmp := where (union $s.Pages $s.Sections) ".Params.toc_hide" "!=" true -}} {{ $pages_tmp = sort $pages_tmp "Title" "asc" -}} {{ $pages_tmp = sort $pages_tmp "Weight" "asc" -}} {{ $pages := $pages_tmp -}} {{ $withChild := gt (len $pages) 0 -}} {{ $manualLink := cond (isset $s.Params "manuallink") $s.Params.manualLink (cond (isset $s.Params "manuallinkrelref") (relref $s $s.Params.manualLinkRelref) $s.RelPermalink ) -}} {{ $manualLinkTitle := cond (isset $s.Params "manuallinktitle") $s.Params.manualLinkTitle $s.Title -}} {{ if and $treeRoot (eq $s.Params.sidebar_root_for "self") -}} {{ with $s.Parent -}} {{ $manualLink = .RelPermalink -}} {{ end -}} {{ end -}} - {{ if (and $p.Site.Params.ui.sidebar_menu_foldable (ge $ulNr 1)) -}} {{/**/ -}} {{- with $s.Params.Icon -}} {{- end -}} {{- $s.LinkTitle -}} {{- /**/ -}} {{- /**/ -}} {{ else -}} {{- with $s.Params.Icon -}} {{- end -}} {{- $s.LinkTitle -}} {{- end -}} {{ if $withChild -}} {{ $ulNr := add $ulNr 1 }} {{ range $pages -}} {{ if (not (and (eq $s $p.Site.Home) (eq .Params.toc_root true))) -}} {{ template "section-tree-nav-section" (dict "page" $p "section" . "shouldDelayActive" $shouldDelayActive "sidebarMenuTruncate" $sidebarMenuTruncate "ulNr" $ulNr "ulShow" $ulShow) }} {{- end }} {{- end }} {{- end }} {{- end -}}