]> juplo.de Git - website/commitdiff
Projekte sind nur im Menü verlinkt, wenn `visible=true`, oder ausgewählt
authorKai Moritz <kai@juplo.de>
Sun, 19 Apr 2026 13:00:18 +0000 (15:00 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 19 Apr 2026 14:19:12 +0000 (16:19 +0200)
* Unter dem Menü-Eintrag für `/projects/` erscheinen nur Projekte, für die
  im Frontmatter der Parameter `visible` 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.

exampleSite/content/projects/hibernate-maven-plugin/_index.html
layouts/_partials/menu/tree.html

index e98d6a910d6539589cf97769946b17115a278f05..41e689318459964ffadf4967c8e4d82a3bfd6986 100644 (file)
@@ -5,6 +5,8 @@ outputs:
   - html
 url: projects/hibernate-maven-plugin/
 layout: article
+params:
+  visible: true
 ---
 <div id="sili-body">
 <h1>Hibernate Maven Plugin</h1><section>
index a3d63ed2260232e6c06d9884f79a3df95be22aae..8e944b07550cb4fb45b313084916ef7de85e24d1 100644 (file)
@@ -5,6 +5,9 @@
     {{- $isAncestor := $page.IsDescendant . -}}
     {{- $isChild := $parent.Eq $page }}
     {{- $isSibling := $parent.Eq (index $page.Ancestors 0) }}
+    {{- $isProject := and (eq $parent.Path "/projects") (not (hasPrefix $page.Path "/projects/")) }}
+    {{- $isVisible := .Params.visible | default false }}
+    {{- if (or (not $isProject) $isVisible) }}
     <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 +52,4 @@
       {{- end }}
     </li>
     {{- end }}
+    {{- end }}