]> juplo.de Git - website/commitdiff
Spezial-Menü für die Untersektionen von `blog` anstatt für `blog` selbst
authorKai Moritz <kai@juplo.de>
Sat, 20 Dec 2025 10:26:02 +0000 (11:26 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 21 Dec 2025 18:28:52 +0000 (19:28 +0100)
--
ALIGN

* Die Menüstruktur wird jetzt nicht mehr aus dem `date`-Parameter
  abgeleitet.
* Stattdessen werden die Blog-Artikel sauber in Unter-Sektionen eingeteilt,
  die nach den Jahren benannt sind.
* Diese Untersektionen setzen dann über Front-Matter explizit das Template
  `year`, dass das besondere Verhalten des Menüs für diese Unterseiten
  definiert.

content/blog/2013/_index.html [new file with mode: 0644]
content/blog/2020/_index.html [new file with mode: 0644]
content/blog/2021/_index.html [new file with mode: 0644]
layouts/_partials/menu.html
layouts/_partials/menu/tree.html
layouts/blog/section.html
layouts/blog/year.html

diff --git a/content/blog/2013/_index.html b/content/blog/2013/_index.html
new file mode 100644 (file)
index 0000000..a3a29e6
--- /dev/null
@@ -0,0 +1,5 @@
+---
+title: Archiv - 2013
+linkTitle: 2013
+layout: year
+---
diff --git a/content/blog/2020/_index.html b/content/blog/2020/_index.html
new file mode 100644 (file)
index 0000000..22c0e2c
--- /dev/null
@@ -0,0 +1,5 @@
+---
+title: Archiv - 2020
+linkTitle: 2020
+layout: year
+---
diff --git a/content/blog/2021/_index.html b/content/blog/2021/_index.html
new file mode 100644 (file)
index 0000000..579088c
--- /dev/null
@@ -0,0 +1,5 @@
+---
+title: Archiv - 2021
+linkTitle: 2021
+layout: year
+---
index a8d39bd130173143c78310cef85c117c480c766e..a82d351997e15effec7701704553da0da9fd23b9 100644 (file)
     <a class="s selected" href="{{ site.Home.RelPermalink }}">Home</a>
   </h2>
   <ul id="submenu" class="submenu selected">
-  {{- partial "inline/menu/tree.html" (dict "pages" $page.Site.Sections "page" $page) }}
-  {{- define "_partials/inline/menu/tree.html" }}
-    {{- $page := .page -}}
-    {{- range .pages -}}
-    {{- $parent := index .Ancestors 0 -}}
-    {{- $isCurrent := eq . $page -}}
-    {{- $isAncestor := $page.IsDescendant . -}}
-    {{- $isChild := $parent.Eq $page }}
-    {{- $isSibling := $parent.Eq (index $page.Ancestors 0) }}
-    <li class="s{{ if or .Pages .Sections}} sub{{ end }}{{ if not (or $isCurrent $isAncestor (and $isSibling (not $page.IsNode)) $isChild) }} off{{ end }}">
-      <!--
-        th:with="
-            child=${pos == len},
-            hidden=${!child && _canonical.get(crumbs.get(pos)) == entry},
-            entry=${hidden?crumbs.get(pos):entry},
-            selected=${(child and crumbs.get(pos-1) + '?about' == entry) or (!child and (crumbs.get(pos) == entry or hidden))},
-            leaf=${pos >= (len - 1) and not selected},
-            sibling=${pos + 1 == len and (_childs.get(uri) == null or uri == parent)},
-            childs=${entry == parent ? null : _childs.get(entry)}
-            "
-        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 }}"
-          >{{ .LinkTitle }}</a>
-      <!--
-      <ul>
-        <li>.: {{ .Path }}</li>
-        <li>$parent: {{ $parent.Path }}</li>
-        <li>$page: {{ $page.Path }}</li>
-        <li>$page.IsNode: {{ $page.IsNode }}</li>
-        <li>$isCurrent: {{ $isCurrent }}</li>
-        <li>$isAncestor: {{ $isAncestor }}</li>
-        <li>$isSibling: {{ $isSibling }}</li>
-        <li>$isChild: {{ $isChild }}</li>
-        <li>.Eq $page: {{ .Eq $page }}</li>
-        <li>.IsAncestor $page: {{ .IsAncestor $page }}</li>
-        <li>.IsDescendant $page: {{ .IsDescendant $page }}</li>
-      </ul>
-      -->
-      {{ if or .Pages .Sections }}
-      <ul class="s{{ if (or $isCurrent $isAncestor) }} active{{ end }}">
-        {{- if .Pages }}
-          {{- partial "inline/menu/tree.html" (dict
-              "pages" .Pages
-              "page" $page
-          ) }}
-        {{- end }}
-      </ul>
-      {{- end }}
-    </li>
-    {{- end }}
-  {{- end }}
+  {{- partial "menu/tree.html" (dict "pages" $page.Site.Sections "page" $page) }}
   </ul>
   <hr class="n"/>
 </nav>
index a8d39bd130173143c78310cef85c117c480c766e..a3d63ed2260232e6c06d9884f79a3df95be22aae 100644 (file)
@@ -1,25 +1,3 @@
-{{- $page := .page }}
-{{- $menuID := .menuID }}
-
-<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">
-    {{- range $page.Site.MainSections }}
-    {{- $section := site.GetPage "section" . }}
-    <li class="m {{ . }}">
-      <a href="{{ $section.RelPermalink }}" class="{{ cond (eq $page.Section .) "m selected" "m" }}">{{ $section.LinkTitle }}</a>
-    </li>
-    {{- end }}
-  </ul>
-  <h2 class="nav submenu">
-    <a class="s selected" href="{{ site.Home.RelPermalink }}">Home</a>
-  </h2>
-  <ul id="submenu" class="submenu selected">
-  {{- partial "inline/menu/tree.html" (dict "pages" $page.Site.Sections "page" $page) }}
-  {{- define "_partials/inline/menu/tree.html" }}
     {{- $page := .page -}}
     {{- range .pages -}}
     {{- $parent := index .Ancestors 0 -}}
@@ -62,7 +40,7 @@
       {{ if or .Pages .Sections }}
       <ul class="s{{ if (or $isCurrent $isAncestor) }} active{{ end }}">
         {{- if .Pages }}
-          {{- partial "inline/menu/tree.html" (dict
+          {{- partial "menu/tree.html" (dict
               "pages" .Pages
               "page" $page
           ) }}
@@ -71,7 +49,3 @@
       {{- end }}
     </li>
     {{- end }}
-  {{- end }}
-  </ul>
-  <hr class="n"/>
-</nav>
index f0eb00da793c79a89d2d477f777f4d448e26639f..acac1bb47ca3c1d09edd1baa006f697ffbcdb8db 100644 (file)
 {{- end }}
 {{- end }}
 {{- end }}{{/* end main */}}
-
-{{- define "menu" }}
-{{- $page := . }}
-<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">
-    {{- range $page.Site.MainSections }}
-    {{- $section := site.GetPage "section" . }}
-    <li class="m {{ . }}">
-      <a href="{{ $section.RelPermalink }}" class="{{ cond (eq $page.Section .) "m selected" "m" }}">{{ $section.LinkTitle }}</a>
-    </li>
-    {{- end }}
-  </ul>
-  <h2 class="nav submenu">
-    <a class="s selected" href="{{ site.Home.RelPermalink }}">Home</a>
-  </h2>
-  <ul id="submenu" class="submenu selected">
-    <li class="s">
-      <a  href="{{ .RelPermalink }}" class="s selected">{{ .LinkTitle }}</a>
-      <ul class="s active">
-        {{- $pages := site.RegularPages }}
-        {{- range $pages.GroupByPublishDate "2006" }}
-        {{- if ne .Key "0001" }}
-        {{- $year := replace .Key "0001" "" }}
-        <li class="s">
-          <a class="s" href="{{ $.RelPermalink }}?year={{ $year }}">{{- $year -}}</a>
-        </li>
-        {{- end }}
-        {{- end }}
-      </ul>
-    </li>
-  </ul>
-  <hr class="n"/>
-</nav>
-{{- end }}{{/* end menu */}}
index f0eb00da793c79a89d2d477f777f4d448e26639f..185a7e8ab7bda74fee93698ee44704bd93713217 100644 (file)
 {{- end }}{{/* end title */}}
 
 {{- define "main" }}
-{{- range .Pages.GroupByPublishDate "2006" }}
-{{- if ne .Key "0001" }}
-<div class="archive-year">
-  {{- $year := replace .Key "0001" "" }}
-  <h2 class="archive-year-header" id="{{ $year }}">
-    <a class="archive-header-link" href="#{{ $year }}">
-      {{- $year -}}
-    </a>
-  </h2>
-  {{- range .Pages.GroupByDate "January" }}
-  <div class="archive-month">
-    <div class="archive-posts">
-      {{- range .Pages }}
-      {{- if eq .Kind "page" }}
-      <div class="archive-entry">
-        <h3 class="archive-entry-title entry-hint-parent">
-          <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}">{{- .Title | markdownify }}</a>
-          {{- if .Draft }}
-          <span class="entry-hint" title="Draft">
-            <svg xmlns="http://www.w3.org/2000/svg" height="15" viewBox="0 -960 960 960" fill="currentColor">
-              <path
-                d="M160-410v-60h300v60H160Zm0-165v-60h470v60H160Zm0-165v-60h470v60H160Zm360 580v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q9 9 13 20t4 22q0 11-4.5 22.5T862.09-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z" />
-            </svg>
-          </span>
-          {{- end }}
-        </h3>
-        <div class="archive-meta">
-          {{- partial "post_meta.html" . -}}
-        </div>
-      </div>
-      {{- end }}
-      {{- end }}
-    </div>
+{{- range .Pages }}
+<div class="archive-entry">
+  <h3 class="archive-entry-title entry-hint-parent">
+    <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}">{{- .Title | markdownify }}</a>
+    {{- if .Draft }}
+    <span class="entry-hint" title="Draft">
+      <svg xmlns="http://www.w3.org/2000/svg" height="15" viewBox="0 -960 960 960" fill="currentColor">
+        <path
+          d="M160-410v-60h300v60H160Zm0-165v-60h470v60H160Zm0-165v-60h470v60H160Zm360 580v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q9 9 13 20t4 22q0 11-4.5 22.5T862.09-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z" />
+      </svg>
+    </span>
+    {{- end }}
+  </h3>
+  <div class="archive-meta">
+    {{- partial "post_meta.html" . -}}
   </div>
-  {{- end }}
 </div>
 {{- end }}
-{{- end }}
 {{- end }}{{/* end main */}}
 
 {{- define "menu" }}
     <a class="s selected" href="{{ site.Home.RelPermalink }}">Home</a>
   </h2>
   <ul id="submenu" class="submenu selected">
-    <li class="s">
+    {{- range $page.Site.MainSections }}
+    {{- with site.GetPage "section" . }}
+    {{- if eq .Path "/blog" }}
+    <li class="s sub">
       <a  href="{{ .RelPermalink }}" class="s selected">{{ .LinkTitle }}</a>
-      <ul class="s active">
-        {{- $pages := site.RegularPages }}
-        {{- range $pages.GroupByPublishDate "2006" }}
-        {{- if ne .Key "0001" }}
-        {{- $year := replace .Key "0001" "" }}
+      <ul class="s">
+        {{- range .Pages -}}
         <li class="s">
-          <a class="s" href="{{ $.RelPermalink }}?year={{ $year }}">{{- $year -}}</a>
+          <a href="{{ .RelPermalink }}" class="s{{ if eq . $page }} selected{{ end }}">{{ .LinkTitle }}</a>
         </li>
-        {{- end }}
-        {{- end }}
+        {{ end }}
+      </ul>
+    </li>
+    {{- else }}
+    <li class="s{{ if or .Pages .Sections}} sub{{ end }} off">
+      <a  href="{{ .RelPermalink }}" class="s">{{ .LinkTitle }}</a>
+      <ul class="s">
+      {{- partial "menu/tree.html" (dict "pages" .Pages "page" $page) }}
       </ul>
     </li>
+    {{- end }}{{/* if */}}
+    {{- end }}{{/* with */}}
+    {{- end }}{{/* range */}}
   </ul>
   <hr class="n"/>
 </nav>