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

index 96314a66c1b0fb74ddef7a6053b015b3a409171e..b9b8732858338c24c4cc8e30105ad7083367a596 100644 (file)
   {{- define "_partials/inline/menu/tree.html" }}
   {{- $current := .current -}}
     {{- range .pages }}
-      {{- $isCurrent := eq . $current -}}
-      {{- $isAncestor := $current.IsDescendant . -}}
-      <li
-        class="s{{ if or .Pages .Sections}} sub{{ end }}{{ if not (or (eq $current .) ($current.IsDescendant .))}} off{{ end }}">
+    {{- $isCurrent := eq . $current -}}
+    {{- $isAncestor := $current.IsDescendant . -}}
+    <li class="s{{ if or .Pages .Sections}} sub{{ end }}{{ if not (or (eq $current .) ($current.IsDescendant .))}} off{{ end }}">
       <!--
         th:with="
             child=${pos == len},
         class="s sub"
         th:class="'s' + (${childs} ? ' sub' : '') + (${selected or sibling or child} ? '' : ' off')"
       -->
-        <a href="{{ .RelPermalink }}" class="s {{ if (or $isCurrent $isAncestor) }} selected{{ end }}">{{ .Title }}</a>
-  <ul class="submenu{{ if (or $isCurrent $isAncestor) }} active{{ end }}">
+      <a  href="{{ .RelPermalink }}"
+          class="s {{ if (or $isCurrent $isAncestor) }} selected{{ end }}"
+          >{{ .Title }}</a>
+      {{ if or .Pages .Sections }}
+      <ul class="submenu{{ if (or $isCurrent $isAncestor) }} active{{ end }}">
         {{- if .Pages }}
           {{- partial "inline/menu/tree.html" (dict
               "pages" .Pages
               "current" $current
           ) }}
         {{- end }}
-  </ul>
-      </li>
+      </ul>
+      {{- end }}
+    </li>
     {{- end }}
   {{- end }}
   </ul>