{{ $current := . }} {{ $version_section := (where .Site.Sections ".Page.Params.version" .Page.Params.version) }} {{ define "sidebar-nav" }} {{ $id := "" }} {{ if not .id }} {{ $id = substr (sha1 .thisPage.Permalink) 0 8 }} {{ else }} {{ $id = .id }} {{ end }} {{ $isParent := (and (ne .childPages nil) (ne (len .childPages) 0)) }} {{ $isCurrent := eq .current .thisPage }} {{ $expand := false }} {{ if .expand }} {{ $expand = .expand }} {{ end }} {{ if or $isCurrent (eq .thisPage .current.Parent) }} {{ $expand = true }} {{ end }}