summaryrefslogtreecommitdiffstats
path: root/themes/aoidh/layouts
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-01-07 13:18:17 -0330
committerSam Anthony <sam@samanthony.xyz>2026-01-07 13:18:17 -0330
commit07183e15036c711d4dbf3a1614e0bade8f014180 (patch)
tree2d6891cae01ac67806c890e3bd8adec5d9abf626 /themes/aoidh/layouts
parentda7a80e34660456a12f882de7eeaf94ddaab5d44 (diff)
downloadsamanthony.xyz-07183e15036c711d4dbf3a1614e0bade8f014180.zip
simplify nav partial
Diffstat (limited to 'themes/aoidh/layouts')
-rw-r--r--themes/aoidh/layouts/_partials/header.html2
-rw-r--r--themes/aoidh/layouts/_partials/menu.html40
-rw-r--r--themes/aoidh/layouts/_partials/nav.html15
3 files changed, 16 insertions, 41 deletions
diff --git a/themes/aoidh/layouts/_partials/header.html b/themes/aoidh/layouts/_partials/header.html
index 8995308..8b590e8 100644
--- a/themes/aoidh/layouts/_partials/header.html
+++ b/themes/aoidh/layouts/_partials/header.html
@@ -1 +1 @@
-{{ partial "menu.html" (dict "menuID" "main" "page" .) }}
+{{ partial "nav.html" . }}
diff --git a/themes/aoidh/layouts/_partials/menu.html b/themes/aoidh/layouts/_partials/menu.html
deleted file mode 100644
index ba80749..0000000
--- a/themes/aoidh/layouts/_partials/menu.html
+++ /dev/null
@@ -1,40 +0,0 @@
-{{- /*
-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 }}
diff --git a/themes/aoidh/layouts/_partials/nav.html b/themes/aoidh/layouts/_partials/nav.html
new file mode 100644
index 0000000..aadd2a8
--- /dev/null
+++ b/themes/aoidh/layouts/_partials/nav.html
@@ -0,0 +1,15 @@
+
+<nav>
+ <ul>
+ {{- $currentPage := . }}
+ {{- range site.Menus.main }}
+ {{- if $currentPage.IsMenuCurrent .Menu . }}
+ <li class="nav-active"><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{- else if $currentPage.HasMenuCurrent .Menu . }}
+ <li class="nav-ancestor"><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{- else }}
+ <li><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{- end }}
+ {{- end }}
+ </ul>
+</nav>