Use to categorize content.
Structure
You can create multiple "vocabularies" which serve as container for "terms".
- vocabulary (e.g. "fruit")
Functionalities
- Centralized CRUD-management of vocabularies & terms (panel view?)
- id necessary (to avoid referenced pages to break upon term changes - preferably "invisible" for the editors)
- Multilingual: have an quick-glance overview of which terms aren't yet translated
- Sort terms
- Field to "select" terms (can be like the current
tag
or multiselect
field?)
- Helper
pages
-methods
taxonomy_filter($vocabulary, $term)
- What about "and" or "or" operators?
taxonomy_sort()
?
taxonomy_terms($vocabulary, $ids = false)
- get a list of terms in a vocabulary which have values in a given set of pages (e.g. for filters)
- Possibility to extend terms with fields
- This could reuse the blueprint+pages paradigm already present in Kirby
- Preferably those "pages" aren't accessible anywhere in Kirby (not via
index()
or path) out of the box
- Add a link from the centralized overview to the "page" to manage data there
Challenges (maybe not for the first version / MVP)
- Hierarchical terms (not only a challenge for the UI, but also for the helper methods to retrieve matches)
- Folksonomy: tag-as-you-go from the "field". Editors can create terms for a given vocabulary from the field; kindof like what we currently have with the
tags
field, but the terms are put into a vocabulary for centralized management.
- Multilingual tagging UI for the field may be hard to do "well"
Implementation ideas
- Create a dedicated location for vocabularies under
site/taxonomies
.
- A vocabulary exists when there is a yaml file in that directory; e.g.
site/taxonomies/fruit.yml
. Contains a "title" and a "list of terms".❓What about multilingual?? separate files?? JSON??
- Relation to terms are stored in a page's content file as
{vocabulary-id}/{term-id}
- This implicates possible difficulties with
search()
as search won't match taxonomy items because id's are stored in the content files
- For vocabularies with additional fields, we could create a directory
content/_drafts/taxonomies
as container to persist the data from the added fields.
- E.g. we want to store an image of each "fruit" on the term, we could create
content/_drafts/taxonomies/fruit
. Each term is added as page below with the term's ID as foldername (slug), with taxonomy-{vocabulary-id}
as template. Blueprints etc could then be set up as you usually do in Kirby.
- Field - blueprint options:
vocabulary
: vocabulary-id
translate
: true/false
required
multiple
- (
create
: create terms from field?)