summaryrefslogtreecommitdiffstats
path: root/themes/aoidh/layouts/_partials/menu.html
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-01-09 08:07:03 -0500
committerSam Anthony <sam@samanthony.xyz>2026-01-09 08:07:03 -0500
commit2ad28cbbfb4287164e7877923291bb18519688fc (patch)
tree7a7dac539d2085cb72cd357246620f7f2021f5e8 /themes/aoidh/layouts/_partials/menu.html
parentebf4af075b194229dd1cf3163b1e3cec1f1d3a0d (diff)
downloadsamanthony.xyz-2ad28cbbfb4287164e7877923291bb18519688fc.zip
replace repo contents with revamped site
Diffstat (limited to 'themes/aoidh/layouts/_partials/menu.html')
-rw-r--r--themes/aoidh/layouts/_partials/menu.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/themes/aoidh/layouts/_partials/menu.html b/themes/aoidh/layouts/_partials/menu.html
new file mode 100644
index 0000000..ba80749
--- /dev/null
+++ b/themes/aoidh/layouts/_partials/menu.html
@@ -0,0 +1,40 @@
+{{- /*
+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 }}
+ <nav>
+ <ul>
+ {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
+ </ul>
+ </nav>
+{{- end }}
+
+{{- define "_partials/inline/menu/walk.html" }}
+ {{- $page := .page }}
+ {{- range .menuEntries }}
+ <li
+ {{- if $page.IsMenuCurrent .Menu . -}}
+ {{- printf " class=%q" "nav-active" | safeHTMLAttr -}}
+ {{- else if $page.HasMenuCurrent .Menu . -}}
+ {{- printf " class=%q" "nav-ancestor" | safeHTMLAttr -}}
+ {{- end -}}>
+ <a
+ {{ printf "href=%q" .URL | safeHTMLAttr }}
+ >{{ .Name }}</a>
+ {{- with .Children }}
+ <ul>
+ {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
+ </ul>
+ {{- end }}
+ </li>
+ {{- end }}
+{{- end }}