From 21b4289ecf44cead65bbe8427724e1769aedca7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Tue, 7 May 2024 22:40:03 +0200 Subject: [PATCH] taxonomy: simplify code #852 --- layouts/partials/term-list.html | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/layouts/partials/term-list.html b/layouts/partials/term-list.html index 03131c5d59..5af8157cee 100644 --- a/layouts/partials/term-list.html +++ b/layouts/partials/term-list.html @@ -14,28 +14,9 @@ {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} {{- $taxonomy_page := $page.Site.GetPage $taxonomy }} -{{- $terms := slice | append (index $page.Params $taxonomy) }} {{- $term_pages := slice }} -{{- range $terms }} - {{- $term := . }} - {{- $term_key := $term }} - {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} - {{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}} - {{- else }} - {{- $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" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}} - {{- else }} - {{- $term_key = ($term | urlize) }} - {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} - {{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}} - {{- end }} - {{- end }} - {{- end }} +{{- range $page.GetTerms $taxonomy }} + {{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}} {{- end }} {{- $taxonomy_title := partial "pageHelper/title.hugo" (dict "page" $taxonomy_page "format" $format "outputFormat" $outputFormat) }} {{- with $term_pages }}