{{- $context := .context -}} {{- $no_sidebar := .no_sidebar | default true -}} {{- $pad_sidebar := true -}} {{- $sidebar_dynamic_class := cond $no_sidebar (cond $pad_sidebar "lg:hidden xl:block" "lg:hidden") "lg:sticky" -}} {{- $root_section := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}} {{- $page_url := $context.RelPermalink -}} {{/* Classes appended to `hb-sidebar-mobile-menu` are modified via sidebar JS, so do not @apply them to `hb-sidebar-mobile-menu` */}}
{{- define "menu-links" -}} {{ template "link-tree" (dict "context" .context "level" 0 "page" .page "pageURL" .pageURL "toc" (.toc | default false)) }} {{- end -}} {{- define "link-tree" -}} {{- if ge .level 4 -}} {{- return -}} {{- end -}} {{- $context := .context -}} {{- $page := .page }} {{- $page_url := .page.RelPermalink -}} {{- $level := .level -}} {{- $toc := .toc | default false -}} {{- with $items := union .context.RegularPages .context.Sections -}} {{- $items = where $items "Params.sidebar.hidden" "!=" true -}} {{- if eq $level 0 -}} {{- range $items.ByWeight }} {{- $active := eq $page_url .RelPermalink -}} {{- $is_expanded := or (.Params.sidebar.open) (.IsAncestor $page) $active | default false }}