Skip to content

Commit

Permalink
tags: split taxonomy and terms templates matcornic#530
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed May 19, 2023
1 parent ea52745 commit 922922c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 47 deletions.
31 changes: 30 additions & 1 deletion layouts/_default/taxonomy.html
Original file line number Diff line number Diff line change
@@ -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" . }}
24 changes: 24 additions & 0 deletions layouts/_default/term.html
Original file line number Diff line number Diff line change
@@ -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" . }}
46 changes: 0 additions & 46 deletions layouts/partials/_taxonomy.html

This file was deleted.

0 comments on commit 922922c

Please sign in to comment.