taxonomy: add h2 subheadings on term page #705

This commit is contained in:
Sören Weber 2023-10-29 23:10:41 +01:00
parent 8e7309dfa6
commit 2846b735c7
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -12,14 +12,29 @@
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default .Data.Term .Title) }}
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
{{- .Content }}
<ul class="columnize">
{{- range sort .Pages "Title" }}
{{- $c:=""}}{{/* display pages of a term */}}
{{- $lastCapital := "" }}
{{- $pages := slice }}
{{- range .Pages }}
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a></li>
{{- $pages = $pages | append (dict "Title" .Title "Page" . )}}
{{- end }}
{{- end }}
{{- range sort $pages ".Title" }}
{{- $capital := substr .Title 0 1 | upper }}
{{- if ne $lastCapital $capital }}
{{- if ne $lastCapital "" }}
</ul>
{{- end }}
<h2 id="{{ $capital | plainify | anchorize }}">{{ $capital }}</h2>
<ul class="columnize">
{{- end }}
{{- $c:=""}}{{/* display pages of a term */}}
<li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Page) }}">{{ .Title }}</a></li>
{{- $lastCapital = $capital }}
{{- end }}
{{- if ne $lastCapital "" }}
</ul>
{{- end }}
<footer class="footline">
</footer>