]> juplo.de Git - website/commitdiff
WIP:layout:menu
authorKai Moritz <kai@juplo.de>
Sun, 14 Dec 2025 09:37:29 +0000 (10:37 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 14 Dec 2025 17:45:14 +0000 (18:45 +0100)
layouts/_partials/menu.html

index a85b2941f544d6fc623b558551e06fb7d24e42c8..e2bbc52bb5c5d50478108b0adf0a2f0b0df23865 100644 (file)
     {{- partial "inline/menu/tree.html" (dict "pages" $page.Site.Sections "current" $page) }}
   </ul>
   {{- end }}
+  {{- define "_partials/inline/menu/tree.html" }}
+  {{- $current := .current -}}
+  {{- $pages := .pages -}}
+  {{- $isCurrent := eq . $current -}}
+  {{- $isAncestor := $current.IsDescendant . -}}
+  <ul class="submenu">
+    {{- range $pages }}
+  
+      <li
+        class="
+          page-tree__item
+          {{ if $isCurrent }} is-current{{ end }}
+          {{ if $isAncestor }} is-ancestor{{ end }}
+        "
+      >
+        <a href="{{ .RelPermalink }}">
+          {{ .Title }}
+        </a>
+  
+        {{- if .Pages }}
+          {{- partial "inline/menu/tree.html" (dict
+              "pages" .Pages
+              "current" $current
+          ) }}
+        {{- end }}
+      </li>
+  
+    {{- end }}
+  </ul>
+  {{- end }}
 
   <ul th:include="${submenu}?:_"
       th:with="
   </ul>
   <hr class="n"/>
 </nav>
-{{- define "_partials/inline/menu/tree.html" }}
-{{- $current := .current -}}
-{{- $pages := .pages -}}
-
-<ul class="page-tree">
-  {{- range $pages }}
-
-    {{- $isCurrent := eq . $current -}}
-    {{- $isAncestor := $current.IsDescendant . -}}
-
-    <li
-      class="
-        page-tree__item
-        {{ if $isCurrent }} is-current{{ end }}
-        {{ if $isAncestor }} is-ancestor{{ end }}
-      "
-    >
-      <a href="{{ .RelPermalink }}">
-        {{ .Title }}
-      </a>
-
-      {{- if .Pages }}
-        {{- partial "inline/menu/tree.html" (dict
-            "pages" .Pages
-            "current" $current
-        ) }}
-      {{- end }}
-    </li>
-
-  {{- end }}
-</ul>
-{{- end }}