{{ $.Scratch.Set "topLevel" . }} {{ range $product := $.Site.Sections }} {{ range $version := .Sections }} {{ range $language := .Sections }} {{if $.CurrentSection}} {{ if .IsAncestor $.CurrentSection }} {{ $.Scratch.Set "topLevel" . }} {{end}} {{end}} {{end}} {{end}} {{end}}
{{ define "menu" }} {{/* .node and .activeNode come from the caller */}} {{- $activeNode := .activeNode -}} {{- with .node -}} {{- $isActive := "" -}} {{- if eq .UniqueID $activeNode.UniqueID -}} {{- $isActive = "active" -}} {{- end -}} {{- $isOpen := false -}} {{- if (or .Params.alwaysOpen (.IsAncestor $activeNode)) -}} {{- $isOpen = true -}} {{- end -}} {{- if .IsSection -}} {{- $children := (add (len .Pages) (len .Sections)) -}}