Pages field, with pages using specific template

Hi,
I am trying to display a pages field, listing only pages with a specific template. I have this:

type: pages
label: Section to suggest
multiple: false
width: 1/3
query: page.index.filterBy('template', 'section')

But am getting the error message Your query must return a set of pages. I have several pages using this template, so am not sure what I am doing wrong here. If anyone has any thoughts that would be great.

Hello,

I would like to know if you want to get all the pages with the template ‘section’ in the current panel page or from all the site?

Because if you want to get from all site you need to use site instead of page.

query: "site.index.filterBy('template', 'section')"

For page I think you have to use the children method

query: "page.children.index.filterBy('template', 'article')"

page.index is totally fine: $page->index() | Kirby CMS

Even if the page doesn’t have any children, this should at least return an empty collection. Wondering why it doesn’t work.

Which Kirby version are you using?

Hi! This was user error on my part, apologies. Please feel free to remove the post