mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-13 22:16:02 +00:00
Mention Reverse function in taxonomy tpl page.
This commit is contained in:
1 parent
a4ea3402d1
commit
03d191fec6
1 file changed
+14
@@ -78,6 +78,9 @@ A Taxonomy is a `map[string]WeightedPages`.
|
|||||||
.ByCount
|
.ByCount
|
||||||
: Returns an OrderedTaxonomy (slice) ordered by number of entries.
|
: Returns an OrderedTaxonomy (slice) ordered by number of entries.
|
||||||
|
|
||||||
|
.Reverse
|
||||||
|
: Returns an OrderedTaxonomy (slice) in reverse order. Must be used with an OrderedTaxonomy.
|
||||||
|
|
||||||
### OrderedTaxonomy
|
### OrderedTaxonomy
|
||||||
|
|
||||||
Since Maps are unordered, an OrderedTaxonomy is a special structure that has a defined order.
|
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>
|
</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/) -->
|
<!-- [See Also Taxonomy Lists](/templates/list/) -->
|
||||||
|
|
||||||
## Order Content within Taxonomies
|
## Order Content within Taxonomies
|
||||||
|
|||||||
Reference in new issue
Block a user