| {{ range $name, $taxonomy := .Site.Taxonomies }}
| {{ if gt (len $taxonomy) 0 }}
article
h2.capitalize.oswald
a.color-black.text-dec-none(href='{{ $name }}') {{ $name }} »
hr.margin-v-1
.flex.flex-wrap
| {{ range $key, $value := $taxonomy }}
a.tag.white.oswald.margin-b-1.margin-r-1(href='{{ .Page.Permalink }}') {{ .Page.Title }} ({{ .Count }})
| {{ end }}
| {{ end }}
| {{ end }}
How do I sort them by the Count Number?
ju52
March 13, 2020, 1:50pm
2
there is a search function in the docs
Do you think I would ask here if the docs has the answer to my specific question?
At least I did not see it there.
ju52
March 14, 2020, 9:41am
4
Sorry, I was to fast
A taxonomy variable has ony a name and a map of pages. There is no Count at this level.
In the implementation is a Count() and ByCount() function, no idea how to use it in templates.
Please @bep - ca you answer this? Thanks
Use .ByCount
: https://gohugo.io/templates/taxonomy-templates/#taxonomy-methods
{{ range $name, $taxo := site.Taxonomies }}
{{ range $taxo.ByCount }}
{{.Term }} : {{ .Pages }} : {{ .Count }}
<br>
{{ end }}
{{ end }}
ju52
March 14, 2020, 12:01pm
6
this sorts the Terms and not the Taxonimies!