Creating Taxonomies#
Taxonomies are kept in content/taxonomies
, each with their own YAML file, and their entries in a matching subdirectory.
taxonomies/|-- tags.yaml|-- tags/|-- good.yaml|-- great.yaml|-- best.yamlantlers
Each Taxonomy's YAML file can contain its title, as well as any data that should be injected into all its terms.
title: Tagsinject:foo: baryaml
Assigning to Collections#
A taxonomy (or multiple taxonomies) can be assigned to a collection.
# content/collections/blog.yamltitle: Blogtaxonomies:- tagsyaml
When editing an entry in that collection, taxonomy fields will be automatically added.
Taxonomizing Entries#
To taxonomize an entry, you can add term values to a field named exactly the same as the taxonomy's handle.
title: My Entrytags:- foo- bar- bazyaml
Now when listing entries that belong to the foo
, bar
, or baz
terms, the entry will appear.
Make sure that the field is named exactly the same as the taxonomy handle, otherwise it will not be considered part of that taxonomy term.
Additional Term Data#
Additional data (custom fields) can be added to a term by creating a yaml file matching the term’s slug.
site/content/taxonomies|-- tags.yaml`-- tags|-- foo.yaml`-- bar.yamlantlers
In the YAML file, add data like so:
food: bacondrink: whiskyyaml
Whenever referencing the Terms in your templates, now {{ food }}
and {{ drink }}
would output bacon
and whiskey
respectively.
Just like entries, these values will be augmented automatically in your templates depending on the blueprint.