From 058460b8105ad1c8e6ceff8952dea4207de716ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 29 Oct 2023 16:38:50 +0100 Subject: [PATCH] taxonomy: allow to sort terms by overwritten title #701 --- layouts/_default/taxonomy.html | 38 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index 0c29655f40..90b7284f41 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -11,27 +11,31 @@ {{- end }}

{{ $title }}

{{- $lastCapital := "" }} -{{- range .Data.Terms.Alphabetical }} - {{- $capital := substr .Page.Data.Term 0 1 | upper }} - {{- if ne $lastCapital $capital }} - {{- if ne $lastCapital "" }} - +{{- $terms := slice }} +{{- range .Data.Terms }} + {{- $terms = $terms | append (dict "Title" (default .Page.Data.Term .Page.Title) "Term" . )}} +{{- end }} +{{- range sort $terms ".Title" }} + {{- $capital := substr .Title 0 1 | upper }} + {{- $len := 0 }} + {{- range .Term.Pages }} + {{- $c:=""}}{{/* count pages of term */}} + {{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }} + {{- $len = add $len 1 }} {{- end }} + {{- end }} + {{- if $len }} + {{- if ne $lastCapital $capital }} + {{- if ne $lastCapital "" }} + + {{- end }}

{{ $capital }}