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,7 +1,3 @@
|
||||||
{{/*
|
|
||||||
099_taxonomy_list.css
|
|
||||||
Eryn Wells <eryn@erynwells.me>
|
|
||||||
*/}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +19,7 @@
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
color: var(--text-color-secondary);
|
color: var(--text-color-secondary);
|
||||||
content: attr(data-term) " =";
|
content: attr(data-name) " =";
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "categories") }}
|
{{ partial "page/taxonomy_list.html" (dict "page" . "taxonomy" "categories") }}
|
||||||
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "tags") }}
|
{{ partial "page/taxonomy_list.html" (dict "page" . "taxonomy" "tags") }}
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
{{- $terms := .page.GetTerms .term -}}
|
{{/*
|
||||||
{{ with $terms }}
|
Generates a list of the terms for a given taxonomy.
|
||||||
<ul class="taxonomy-list" data-term="{{ $.term }}">
|
|
||||||
|
@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 . }}
|
{{ range . }}
|
||||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue