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.yaml
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: bar
Assigning to Collections
A taxonomy (or multiple taxonomies) can be assigned to a collection.
# content/collections/blog.yaml title: Blogtaxonomies: - tags
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 - baz
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.yaml
In the YAML file, add data like so:
food: bacondrink: whisky
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.