mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 14:17:43 +00:00
Update taxonomy methods
This commit is contained in:
1 parent
7461724902
commit
e57da3f00d
1 file changed
+14
-6
@@ -41,14 +41,16 @@ See [Template Lookup](/templates/lookup-order/).
|
|||||||
|
|
||||||
A Taxonomy is a `map[string]WeightedPages`.
|
A Taxonomy is a `map[string]WeightedPages`.
|
||||||
|
|
||||||
.Get(term)
|
.Get TERM
|
||||||
: Returns the WeightedPages for a term.
|
: Returns the WeightedPages for a given term. For example: ;
|
||||||
|
`site.Taxonomies.tags.Get "tag-a"`.
|
||||||
|
|
||||||
.Count(term)
|
.Count TERM
|
||||||
: The number of pieces of content assigned to this term.
|
: The number of pieces of content assigned to the given term. For example: \
|
||||||
|
`site.Taxonomies.tags.Count "tag-a"`.
|
||||||
|
|
||||||
.Alphabetical
|
.Alphabetical
|
||||||
: Returns an OrderedTaxonomy (slice) ordered by Term.
|
: Returns an OrderedTaxonomy (slice) ordered by term.
|
||||||
|
|
||||||
.ByCount
|
.ByCount
|
||||||
: Returns an OrderedTaxonomy (slice) ordered by number of entries.
|
: Returns an OrderedTaxonomy (slice) ordered by number of entries.
|
||||||
@@ -78,6 +80,9 @@ Each element of the slice has:
|
|||||||
.Count
|
.Count
|
||||||
: The number of pieces of content assigned to this term.
|
: The number of pieces of content assigned to this term.
|
||||||
|
|
||||||
|
.Page
|
||||||
|
: Returns a page reference for this term.
|
||||||
|
|
||||||
.Pages
|
.Pages
|
||||||
: All Pages assigned to this term. All [list methods][renderlists] are available to this.
|
: All Pages assigned to this term. All [list methods][renderlists] are available to this.
|
||||||
|
|
||||||
@@ -89,9 +94,12 @@ WeightedPages is simply a slice of WeightedPage.
|
|||||||
type WeightedPages []WeightedPage
|
type WeightedPages []WeightedPage
|
||||||
```
|
```
|
||||||
|
|
||||||
.Count(term)
|
.Count
|
||||||
: The number of pieces of content assigned to this term.
|
: The number of pieces of content assigned to this term.
|
||||||
|
|
||||||
|
.Page
|
||||||
|
: Returns a page reference for this term.
|
||||||
|
|
||||||
.Pages
|
.Pages
|
||||||
: Returns a slice of pages, which then can be ordered using any of the [list methods][renderlists].
|
: Returns a slice of pages, which then can be ordered using any of the [list methods][renderlists].
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user