hugo-theme-relearn/layouts/partials/_taxonomy.html
2023-05-19 00:14:08 +02:00

46 lines
No EOL
1.6 KiB
HTML

{{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- partial "header.html" . }}
<article>
{{- $page := . }}
{{- $title := "" }}
{{- if eq .Kind "taxonomy" }}
{{- $title = i18n .Data.Plural }}
{{- if not $title }}
{{- $title = .Data.Plural | humanize }}
{{- end }}
{{- else }}
{{- $title = i18n .Data.Singular }}
{{- if not $title }}
{{- $title = .Data.Singular | humanize }}
{{- end }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (.Title | humanize) }}
{{- end }}
<h1 id="{{ $title | anchorize }}">{{ $title }}</h1>
<ul>
{{- range .Data.Terms.Alphabetical }}
{{- $c:=""}}{{/* display terms of a taxonomy */}}
{{- $len := 0 }}
{{- range .Pages }}
{{- $c:=""}}{{/* count pages of term */}}
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
{{- $len = add $len 1 }}
{{- end }}
{{- end }}
{{- if $len }}
<li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Page) }}">{{ .Page.Title }}</a> ({{ $len }})</li>
{{- end }}
{{- else }}
{{- range sort .Pages "Title" }}
{{- $c:=""}}{{/* display pages of a term */}}
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a></li>
{{- end }}
{{- end }}
{{- end }}
</ul>
<footer class="footline">
</footer>
</article>
{{- partial "footer.html" . }}