Mention Reverse function in taxonomy tpl page.

This commit is contained in:
Ricardo N Feliciano 2017-12-13 18:37:25 -05:00 committed by digitalcraftsman
parent a4ea3402d1
commit 03d191fec6

View File

@ -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