Hi all,
I am struggling since almost a day to filter a pages field list by a value I have given the pages by a Structure Field.
A little bit more details:
I have a list of locations. Therefore I have created a template blueprint called locations
. Inside this blueprint I can do two things:
- Creating new locations using the
pages
-section, so every locations gets its own page. - Creating categories such as castle, garden, hall, gym, … (you get the idea) and also creating a unique id for every category like 123456 using a Structure field
Inside the created location
page I can choose the categories by using a multiselect field querying the created categories of the parent site called locations
.
So far so good. Now the real question:
On other pages of my site, I want to show a list, where some selected locations are shown. On one page, there should it be possible to choose only locations of one specific category.
Inside the blueprint of this page, I have used the pages
-field. When I query the locations with
query: site.find('locations').children
I will get indeed a list of all created locations. But in this case I want to get a list of only one category, which I created on the locations site in the Structure field.
When I use
query: site.find('locations').children.filterBy('categoryid', '==', '123456')
I just get the error: Your query must return a set of pages.
I just don’t get it what I am querying wrong… maybe you have an idea how I get the prefiltered set of pages?
Thanks, Nick
P.S. Is it possible to sort the pages inside the pages field, not by number but alphabetically