From 667e11c4ec3835d959aab1797647bd0a49869674 Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 21 Oct 2014 23:35:24 +0200 Subject: Init commit --- content/taxonomies/methods.md | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 content/taxonomies/methods.md (limited to 'content/taxonomies/methods.md') diff --git a/content/taxonomies/methods.md b/content/taxonomies/methods.md new file mode 100644 index 0000000..d7a3bc3 --- /dev/null +++ b/content/taxonomies/methods.md @@ -0,0 +1,54 @@ +--- +date: 2014-05-26 +linktitle: Structure & Methods +menu: + main: + parent: taxonomy +next: /extras/aliases +prev: /taxonomies/ordering +title: Using Taxonomies +weight: 75 +--- + +Hugo makes a set of values and methods available on the various Taxonomy structures. + +## Taxonomy Methods + +A Taxonomy is a `map[string]WeightedPages`. + +**.Get(term)** Returns the WeightedPages for a term.
+**.Count(term)** The number of pieces of content assigned to this term.
+**.Alphabetical** Returns an OrderedTaxonomy (slice) ordered by Term.
+**.ByCount** Returns an OrderedTaxonomy (slice) ordered by number of entries.
+ +## OrderedTaxonomy + +Since Maps are unordered, an OrderedTaxonomy is a special structure that has a defined order. + + []struct { + Name string + WeightedPages WeightedPages + } + +Each element of the slice has: + +**.Term** The Term used.
+**.WeightedPages** A slice of Weighted Pages.
+**.Count** The number of pieces of content assigned to this term.
+**.Pages** All Pages assigned to this term. All [list methods](/templates/list/) are available to this.
+ +## WeightedPages + +WeightedPages is simply a slice of WeightedPage. + + type WeightedPages []WeightedPage + +**.Count(term)** The number of pieces of content assigned to this term.
+**.Pages** Returns a slice of pages, which then can be ordered using any of the [list methods](/templates/list/).
+ + + + + + + -- cgit v1.3