--- title: ByCount description: Returns an ordered taxonomy, sorted by the number of pages associated with each term. categories: [] keywords: [] action: related: - methods/taxonomy/Alphabetical returnType: page.OrderedTaxonomy signatures: [TAXONOMY.ByCount] toc: true --- The `ByCount` method on a `Taxonomy` object returns an [ordered taxonomy], sorted by the number of pages associated with each [term]. While a `Taxonomy` object is a [map], an ordered taxonomy is a [slice], where each element is an object that contains the term and a slice of its [weighted pages]. {{% include "methods/taxonomy/_common/get-a-taxonomy-object.md" %}} ## Get the ordered taxonomy Now that we have captured the “genres” Taxonomy object, let’s get the ordered taxonomy sorted by the number of pages associated with each term: ```go-html-template {{ $taxonomyObject.ByCount }} ``` To reverse the sort order: ```go-html-template {{ $taxonomyObject.ByCount.Reverse }} ``` To inspect the data structure: ```go-html-template
{{ jsonify (dict "indent" " ") $taxonomyObject.ByCount }}``` {{% include "methods/taxonomy/_common/ordered-taxonomy-element-methods.md" %}} ## Example With this template: ```go-html-template {{ range $taxonomyObject.ByCount }}