]> juplo.de Git - website/commitdiff
WIP:layout:menu
authorKai Moritz <kai@juplo.de>
Sat, 13 Dec 2025 15:52:00 +0000 (16:52 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 14 Dec 2025 17:45:14 +0000 (18:45 +0100)
hugo.yaml
layouts/_partials/menu.html

index 2ffc74fc7d740939961a8391c00d5465b22d0247..104b8a6d381871fea491b510cfcf100d9b259542 100644 (file)
--- a/hugo.yaml
+++ b/hugo.yaml
@@ -1,5 +1,9 @@
 baseURL: https://example.org/
 languageCode: en-US
+mainSections:
+  - blog
+  - projects
+  - about
 menus:
   main:
   - name: Home
index e097ffdfcd3aebf297abdd3d52c1dbc677bc4f60..4da181378d307f812db0c52b50fa5687b2fafd99 100644 (file)
@@ -1,38 +1,18 @@
-{{- /*
-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 }}
 
-<nav id="nav"
-    th:include="~{::#navigation}?:_"
-    th:with="section=${crumbs != null && crumbs.size() > 1 ? crumbs[1] : null}"
-    >
+<nav id="nav">
   <hr class="n"/>
   <a class="hide" href="#top" title="Show Content">Jump back to the top of the page</a>
   <h1 class="nav">Navigation</h1>
   <h2 class="nav menu">Section-Menu</h2>
   <ul id="menu" class="cf">
-    <li th:each="entry : ${_childs.get('/index.html')}"
-        th:with="title=${_titles.get(entry)}"
-        class="m blog"
-        th:class="'m ' + ${title}">
-      <a href="../blog/"
-         th:href="@{${entry}}"
-         class="m"
-         th:class="${section == entry} ? 'm selected' : 'm'"
-         th:text="${_titles.get(entry)}">Blog</a>
+    {{- range $page.Site.MainSections }}
+    {{- $section := site.GetPage "section" . }}
+    <li class="m {{ . }}">
+      <a href="{{ $section.RelPermalink }}" class="m">{{ $section.LinkTitle }}</a>
     </li>
-    <!--/*-->
-    <li class="m projects"><a href="../projects.html" class="m selected">Projects</a></li>
-    <li class="m about"><a href="../about.html" class="m">About</a></li>
-    <!--*/-->
+    {{- end }}
   </ul>
   <h2 class="nav submenu">
     <span class="s">Submenu for section</span>