{{- /* Site header navigation. Every element has a stable `ananke-nav-*` or `ananke-submenu*` hook class for custom CSS. The Tachyons classes next to it are defaults; replace them per element with `[params.ananke.navigation.classes]`. Collapsing (below the Tachyons `-l` breakpoint) and the dropdown position are in _styles.css. Hooks: `navigation-start` renders after the brand link (for example a search box), `navigation-end` renders at the end of the collapsible panel. Without JavaScript, the menu and all submenus are visible and the toggle buttons stay hidden. site-scripts.html enhances both. */ -}} {{- /* Returns the classes for each navigation element: configured or default. */ -}} {{- define "_partials/AnankeNavigationClasses.html" -}} {{- $rtl := compare.Eq site.Language.Direction "rtl" -}} {{- $background := site.Params.background_color_class | compare.Default "bg-black" -}} {{- $defaults := collections.Dictionary "nav" "pv3 ph3 ph4-ns" "inner" "flex flex-wrap items-center justify-between center" "brand" "f3 fw2 hover-white white-90 dib no-underline" "toggle" "f5 white-90 hover-white" "panel" "flex-l items-center" "menu" (compare.Conditional $rtl "pr0 ml3" "pl0 mr3") "item" (printf "list f5 f4-ns fw4 dib %s" (compare.Conditional $rtl "pl3" "pr3")) "link" "hover-white white-90 no-underline" "submenu_toggle" "hover-white white-90" "submenu" (printf "list ma0 pv2 ph0 br2 ba b--white-20 %s" $background) "submenu_link" "db pv2 ph3 f5 white-90 hover-white hover-bg-white-10 no-underline" -}} {{- $configured := collections.Dictionary -}} {{- with site.Params.ananke.navigation -}} {{- with .classes -}}{{- $configured = . -}}{{- end -}} {{- end -}} {{- $classes := collections.Dictionary -}} {{- range $key, $default := $defaults -}} {{- $value := collections.Index $configured $key | compare.Default $default -}} {{- $classes = collections.Merge $classes (collections.Dictionary $key $value) -}} {{- end -}} {{- return $classes -}} {{- end -}} {{- /* Returns the aria-current value for a menu entry: "page" if it links to the current page, "true" if the current page is below it (Hugo's HasMenuCurrent, which includes pages inside the entry's section), or an empty string. */ -}} {{- define "_partials/AnankeMenuCurrent.html" -}} {{- $current := "" -}} {{- if .page.IsMenuCurrent "main" .entry -}} {{- $current = "page" -}} {{- else if .page.HasMenuCurrent "main" .entry -}} {{- $current = "true" -}} {{- end -}} {{- return $current -}} {{- end -}} {{- define "_partials/AnankeSubmenuIcon.html" -}} {{- end -}} {{- define "_partials/AnankeMenuToggleIcon.html" -}} {{- end -}} {{- define "_partials/AnankeSubmenu.html" -}} {{- $page := .page }} {{- $classes := .classes }} {{- end -}} {{- $classes := partials.Include "AnankeNavigationClasses.html" . -}}