]> juplo.de Git - website/commitdiff
Nur aktuelle (oder gerade ausgewählte) Projekte im Projekte-Menü verlinkt
authorKai Moritz <kai@juplo.de>
Sun, 19 Apr 2026 13:00:18 +0000 (15:00 +0200)
committerKai Moritz <kai@juplo.de>
Wed, 29 Apr 2026 11:20:32 +0000 (13:20 +0200)
* Unter dem Menü-Eintrag für `/projects/` erscheinen nur Projekte, für die
  im Frontmatter der Parameter `current` explizit auf `true gesetzt ist.
* Alle anderen Unterseiten von `/projects/` werden im Menü nicht angezeigt.
* *Ausnahme:* Die Seite ist gerade ausgewählt -- _Diese Ausnahme ist nötig,
  da ansonsten kein Menü-Pfad mehr für nicht sichtbare Projekte (aka: die
  Dokumentation älterer oder unveröffentlichter Projekt-Versionen) angezeigt
  wird.

layouts/_partials/menu/tree.html

index a3d63ed2260232e6c06d9884f79a3df95be22aae..13292b5dc499b409509af4bd20ecaec2d0eaef5c 100644 (file)
@@ -5,6 +5,11 @@
     {{- $isAncestor := $page.IsDescendant . -}}
     {{- $isChild := $parent.Eq $page }}
     {{- $isSibling := $parent.Eq (index $page.Ancestors 0) }}
+    {{- $projects := .GetPage "/projects" }}
+    {{- $isNotAProject := not (hasPrefix .Path "/projects/") }}
+    {{- $isVisible := .Params.current | default false }}
+    {{- $isSelectedProjectPage := or (.Eq $page) $isAncestor (and $isSibling (not ($parent.Eq $projects))) (and $isChild (not ($parent.Eq $projects))) }}
+    {{- if or $isNotAProject $isVisible $isSelectedProjectPage}}
     <li class="s{{ if or .Pages .Sections}} sub{{ end }}{{ if not (or $isCurrent $isAncestor (and $isSibling (not $page.IsNode)) $isChild) }} off{{ end }}">
       <!--
         th:with="
@@ -49,3 +54,4 @@
       {{- end }}
     </li>
     {{- end }}
+    {{- end }}