]> juplo.de Git - website/commitdiff
WIP:thymeleaf:taxonomies-on-page
authorKai Moritz <kai@juplo.de>
Wed, 3 Dec 2025 17:09:52 +0000 (18:09 +0100)
committerKai Moritz <kai@juplo.de>
Wed, 3 Dec 2025 18:58:03 +0000 (19:58 +0100)
hugo/themes/thymeleaf/layouts/_partials/terms.html

index ad009da83a81db7371e37973e971f81979657f5f..afa5c04a02506f38befcac80ed9644f7d08a0126 100644 (file)
@@ -1,17 +1,20 @@
-{{- with $page := .Page }}
+{{- $page := .Page }}
 {{- range $taxonomy, $terms := .Page.Site.Taxonomies }}
 <h3><a href="{{ .Page.RelPermalink }}">{{ .Page.LinkTitle }}</a></h3>
 <h4>$taxonomy: {{ $taxonomy }}</h4>
-{{- with index .Page.Site.Taxonomies $taxonomy }}
-<pre>{{ debug.Dump .Page }}</pre>
-{{- end }}
+{{- $taxonomyPage := index .Page.Site.Taxonomies $taxonomy }}
+<h4>$taxonomyPage.Page</h4>
+<pre>{{ debug.Dump $taxonomyPage.Page }}</pre>
+<h4>$page.GetTerms $taxonomy</h4>
+<pre>{{ debug.Dump ($page.GetTerms $taxonomy) }}</pre>
 <h4>List</h4>
 <ul>
   {{- range $term, $pages := $terms }}
+  {{- $termPath := printf "%s/%s" $taxonomyPage.Page.Path $term }}
+  <li>{{ $termPath}}: {{ $taxonomyPage.Count $term }}</li>
   {{- if in ($page.GetTerms $taxonomy) $term }}
   <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
   {{- end }}
   {{- end }}
 </ul>
 {{- end }}
-{{- end }}