tags: split taxonomy and terms templates #530

This commit is contained in:
Sören Weber 2023-05-19 09:04:44 +02:00
parent ea5274569b
commit 922922cf94
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
3 changed files with 54 additions and 47 deletions

View file

@ -1 +1,30 @@
{{- partial "_taxonomy.html" . }} {{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- partial "header.html" . }}
<article>
{{- $page := . }}
{{- $title := i18n .Data.Plural }}
{{- if not $title }}
{{- $title = .Data.Plural | 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 }}
{{- end }}
</ul>
<footer class="footline">
</footer>
</article>
{{- partial "footer.html" . }}

View file

@ -0,0 +1,24 @@
{{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- partial "header.html" . }}
<article>
{{- $page := . }}
{{- $title := i18n .Data.Singular }}
{{- if not $title }}
{{- $title = .Data.Singular | humanize }}
{{- end }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (.Title | humanize) }}
<h1 id="{{ $title | anchorize }}">{{ $title }}</h1>
<ul>
{{- 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 }}
</ul>
<footer class="footline">
</footer>
</article>
{{- partial "footer.html" . }}

View file

@ -1,46 +0,0 @@
{{- 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" . }}