Query multiselect options from another template for select field

Hey there,

I’m using a multiselect field on a page blueprint to provide a filter option in the frontend. Now I want my client on another page to be able to select one of the options using a select field.

At site/blueprints/pages/project.yml the options are defined:

title: Project

status:
  draft: true
  listed: true

columns:
  - width: 2/3
    fields:
      cover: fields/cover
  - width: 1/3
    fields:
      categories:
        type: multiselect
        label: Categories
        translate: false
        options:
          0_corporate: Corporate
          1_packaging: Packaging
          2_illustration: Illustration
          3_animation: Animation
          4_print: Print
...

And at site/blueprints/pages/home.yml I would like to query them:

title: Home

status:
  draft: false
  listed: true

title: Home

columns:
  ...

  - width: 1/3
    sections:
      categorySection:
        type: fields
        fields:
          selectedCategory:
            label: Filter
            type: select
            options: query
            query: ???
  ...

Many thanks in advance!

query: site.categories.split(',')

Oh wow, you’re fast! Thanks!

That didn’t work. I think I have to query for the project blueprint?

Maybe to be a bit more clear: I don’t want to query for the set values on a page, but all options defined in the categories options. Alternatively a set of all selected categories of all project pages would also be fine.

Oops, I didn’t look close enough and thought those categories were defined in the site blueprint.

To get all used categories from the project pages:

query: site.find('projects').children.listed.pluck('categories', ',', true)

awesome, thank you!