From 5fb02b2dd7be460d064b8667072f9cd72f5090c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 12 Feb 2024 22:31:07 +0100 Subject: [PATCH] theme: compatiblity for taxonomy term lists with Hugo 0.123 #771 --- layouts/partials/term-list.html | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/layouts/partials/term-list.html b/layouts/partials/term-list.html index a38aa15650..39e012ab03 100644 --- a/layouts/partials/term-list.html +++ b/layouts/partials/term-list.html @@ -15,17 +15,23 @@ {{- $terms := slice | append (index $page.Params $taxonomy) }} {{- $term_pages := slice }} {{- range $terms }} - {{- $term := trim . " " }} - {{- if not $term }} - {{- continue }} - {{- end }} - {{- $term_key := ($term | plainify | anchorize) }} + {{- $term := . }} + {{- $term_key := $term }} {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} {{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} {{- else }} - {{- $term_key = ($term | urlize) }} + {{- $term = trim $term " " }} + {{- if not $term }} + {{- continue }} + {{- end }} + {{- $term_key = ($term | plainify | anchorize) }} {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} {{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} + {{- else }} + {{- $term_key = ($term | urlize) }} + {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} + {{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} + {{- end }} {{- end }} {{- end }} {{- end }}