Use singular or plural taxonomy names depending on how many items are in the taxonomy for the page
This commit is contained in:
parent
1b463e35d8
commit
97aa739b3f
3 changed files with 17 additions and 10 deletions
|
@ -1,2 +1,2 @@
|
|||
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "categories") }}
|
||||
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "tags") }}
|
||||
{{ partial "page/taxonomy_list.html" (dict "page" . "taxonomy" "categories") }}
|
||||
{{ partial "page/taxonomy_list.html" (dict "page" . "taxonomy" "tags") }}
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
{{- $terms := .page.GetTerms .term -}}
|
||||
{{ with $terms }}
|
||||
<ul class="taxonomy-list" data-term="{{ $.term }}">
|
||||
{{/*
|
||||
Generates a list of the terms for a given taxonomy.
|
||||
|
||||
@param {Page} .page The current page
|
||||
@param {String} .taxonomy The name of the taxonomy
|
||||
*/}}
|
||||
|
||||
{{- $taxonomy := .taxonomy -}}
|
||||
{{ with .page.GetTerms $taxonomy }}
|
||||
{{- $name := $taxonomy -}}
|
||||
{{- with T $taxonomy (len .) }}
|
||||
{{ $name = . }}
|
||||
{{ end -}}
|
||||
<ul class="taxonomy-list" data-name="{{ $name }}">
|
||||
{{ range . }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue