Create global categories that can be multiselected on pages

Hi,
I’m new to kirby and struggling to handle global categories. I’m unsure if i should create a category folder or how to best structure it. Could not find any tutorial/documentation about this.

I have article pages, that i would like to categorize in Type (e.g. Audio, Video, Other), Content (Activism, Other) and Art (Digital, Analog, Other).
On these Pages I should be able to multiselect values from those 3 categories, that can be added and edited only via the panel globally.
(So I don’t want to add multiselect value options fields manually within my article page but receive those category option select from my global site.)
Further I want to be able to access those categories via link e.g. /category/audio and then list matching article pages.

How do I best achive this?

For the global categories, it depends how global you want them to be. So you could define them either in the site object (site.yaml blueprint => storage in site.txt) or in the article parent page. In both cases in a structure field.

As an alternative, the categories could be created as subpages of some categories parent page.

As regards filtering, you can either use parameters, or if you want to filter by Url, you would use routes, see Filtering via routes | Kirby CMS

1 Like

Thanks for your quick response.

So if i use the article parent to store it there, how should the yml look like?

my articles.yml:

# site/blueprints/pages/articles.yml
...
  - width: 1/1
      fields:
        tags_type:
          label: Article Tags Type
          type: tags

my article.yml:

# site/blueprints/pages/article.yml
...
  - width: 1/3
    sections:
      meta:
        type: fields
        fields:
          tags_type:
            label: Article Tags Type
            type: multiselect
            options: 
              query:
                fetch: page.parent.tags_type.toOptions
          tags: true

Screenshot 2024-05-31 at 18.05.21

Nope.

  options:
    type: query
    query: page.parent.tags_type.split
1 Like