mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
tags: split taxonomy and terms templates #530
This commit is contained in:
parent
ea5274569b
commit
922922cf94
3 changed files with 54 additions and 47 deletions
|
@ -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
layouts/_default/term.html
Normal file
24
layouts/_default/term.html
Normal 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" . }}
|
|
@ -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" . }}
|
Loading…
Reference in a new issue