From a1ebb1c85ae6d749170ce4e9b18f0bdec92d27e8 Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 28 Jun 2025 11:20:24 -0700 Subject: bare --- layouts/_partials/menu.html | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 layouts/_partials/menu.html (limited to 'layouts/_partials/menu.html') diff --git a/layouts/_partials/menu.html b/layouts/_partials/menu.html new file mode 100644 index 0000000..14245b5 --- /dev/null +++ b/layouts/_partials/menu.html @@ -0,0 +1,51 @@ +{{- /* +Renders a menu for the given menu ID. + +@context {page} page The current page. +@context {string} menuID The menu ID. + +@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }} +*/}} + +{{- $page := .page }} +{{- $menuID := .menuID }} + +{{- with index site.Menus $menuID }} + +{{- end }} + +{{- define "_partials/inline/menu/walk.html" }} + {{- $page := .page }} + {{- range .menuEntries }} + {{- $attrs := dict "href" .URL }} + {{- if $page.IsMenuCurrent .Menu . }} + {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} + {{- else if $page.HasMenuCurrent .Menu .}} + {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} + {{- end }} + {{- $name := .Name }} + {{- with .Identifier }} + {{- with T . }} + {{- $name = . }} + {{- end }} + {{- end }} +
  • + {{ $name }} + {{- with .Children }} + + {{- end }} +
  • + {{- end }} +{{- end }} -- cgit v1.2.3