One pager - Query field to separate subpages and parts?

Hello,

I am building a website using the one-pager cookbook. I have some pages with have parts and subpages. In the templates and frontend, there is no issue to separate the parts and the subpages of a page with filterBy, but in the panel, the same query doesn’t work. I’m trying to add a field of type pages, which should only include the subpages and exclude the parts.

sections:
  parts:
    headline: Sections
    type: pages
    status: all
    info: "{{ page.intendedTemplate }}"
    image: false
    templates:
      - section-banniere
      - section-1r
      - section-1r2c
      - section-2r2c
      - section-3c
      - section-4img
      - section-media

  subpages:
    headline: Subpages without parts
    type: pages
    multiple: true
    options: query
    query: page.children.listed.filterBy("intendedTemplate", "!*=", "section")

This query works for a select, but not with a pages field. I checked this solution, but I didn’t find a way to make it work with a collection too. Is there a way to use the query language to filter these pages or is it better to use a plugin like Kirby Modules?

Thanks,

subpages is a section, like parts. Sections have a parent property, not a query property. Why do you need a field here? Do you want the user to select something?

Thanks for the reply!
I would like to display two separate lists on the panel. One for the subpages and one for the parts, and I would like to let the users add more subpages or sections if they want. I didn’t find a good way to display the subpages without the parts.

You can do that in the same way as for your parts section, by listing the templates that are allowed for the subpages. So remove the options and the query, and do the same as in the other section, only with the other templates.

2 Likes

Quite simple in this case. No reason to use a query. Thanks a lot!