mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-13 18:27:53 -04:00
Mention Reverse function in taxonomy tpl page.
This commit is contained in:
parent
a4ea3402d1
commit
03d191fec6
@ -78,6 +78,9 @@ A Taxonomy is a `map[string]WeightedPages`.
|
||||
.ByCount
|
||||
: Returns an OrderedTaxonomy (slice) ordered by number of entries.
|
||||
|
||||
.Reverse
|
||||
: Returns an OrderedTaxonomy (slice) in reverse order. Must be used with an OrderedTaxonomy.
|
||||
|
||||
### OrderedTaxonomy
|
||||
|
||||
Since Maps are unordered, an OrderedTaxonomy is a special structure that has a defined order.
|
||||
@ -160,6 +163,17 @@ Taxonomies can be ordered by either alphabetical key or by the number of content
|
||||
</ul>
|
||||
```
|
||||
|
||||
### Order by Least Popular Example
|
||||
|
||||
```
|
||||
<ul>
|
||||
{{ $data := .Data }}
|
||||
{{ range $key, $value := .Data.Terms.ByCount.Reverse }}
|
||||
<li><a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
```
|
||||
|
||||
<!-- [See Also Taxonomy Lists](/templates/list/) -->
|
||||
|
||||
## Order Content within Taxonomies
|
||||
|
Loading…
x
Reference in New Issue
Block a user