Learn

taxonomy

Display a list of taxonomy values.

{{ taxonomy:listing }}

Shows a listing of taxonomy values that have been used for the given parameters.

Sample Usage

<h2>Categories</h2>

<ul>
    {{ taxonomy:listing type="tags" }}
        <li><a href="{{ url }}">{{ name }}</a></li>     
    {{ /taxonomy:listing }}
</ul>

Parameters

This tag accepts the following parameters:

type

Required

The taxonomy field to look for. This can be any field defined in your _taxonomy setting. Remember, taxonomies can be any field. Author, topic, sport, genre, you name it.

{{ taxonomy:listing type="tags" }}

folder

The folder (or folders) to look through to find taxonomy values.

You can specify multiple folders by pipe delimiting them, or use use a wildcard * character at the end of the folder name will let you traverse through all subfolders.

Default: the current folder

{{ taxonomy:listing folder="blog|news*" }}

show_hidden

Boolean setting to show hidden files or not.

Default: false

{{ taxonomy:listing show_hidden="false" }}

since

If set, limits the date to the earliest point in time from which date-based entries should be fetched. Uses PHP’s strtotime method allowing you to use plain English to specify the date.

Default: null

{{ taxonomy:listing since="Last Sunday" }}
{{ taxonomy:listing since="January 15th, 2013" }}
{{ taxonomy:listing since="Yesterday" }}

until

If set, limits the date to the latest point in time from which date-based entries should be fetched. Uses PHP’s strtotime method allowing you to use plain English to specify the date.

{{ taxonomy:listing until="Next Saturday" }}
{{ taxonomy:listing until="Midnight" }}
{{ taxonomy:listing until="Nov 25" }}

conditions

Conditions let you filter based on custom field values the use a comma-separated string of key:value pairs.

{{ taxonomy:listing conditions="author:jack" }}
{{ taxonomy:listing conditions="type:beef|pork|bacon" }}

You can also string together multiple conditions by separating them with commas:

conditions="author:jack,featured:yes"

You can even perform “not” conditions by adding a ! mark:

conditions="author:!jack"

min_count

The minimum number of matching entries a value must have to show up in the list

{{ taxonomy:listing min_count="1" }}

sort_by

Allows you to specify the field to sort the list on. In addition to any custom field, you can also sort by date, numeric, and random.

Default: date or numeric, depending on entry type.

{{ taxonomy:listing sort_by="author" }}
{{ taxonomy:listing sort_by="title" }}
{{ taxonomy:listing sort_by="random" }}

sort_dir

Sets whether the tag should sort your sort_by field(s) by ascending (asc) or descending (desc) value. Numerically ordered entries will ascend and date-based will descend by default. It’s a good idea to always set this parameter.

{{ taxonomy:listing sort_dir="desc" }}

limit

If set, limits the maximum number of entries to display.

{{ taxonomy:listing limit="10" }}

offset

If set, skips over the specified number of entries after sorting has been applied.

{{ taxonomy:listing offset="1" }}

Variables

The follow variables are available inside your {{ taxonomy:listing }} tag loop results.

Variable Description
{{ name }} the taxonomy value
{{ url }} URL to view the taxonomy page for this value, based on the folder given
{{ slug }} the slug specifying this taxonomy’s folder and value
{{ count }} an iterator for the number of values displayed
{{ first }} a boolean as to whether or not the current loop is the first pass through or not
{{ last }} a boolean as to whether or not the current loop is the last pass through or not
{{ results }} the total number of content pieces found matching this taxonomy and folder
{{ total_results }} the total number of taxonomy values found with the given parameters

This article was last updated on September 13th, 2016. Find an error? Please let us know!