What I try to do:
Show a list of pages of the C on the panel start page (site.yml)
My apporach:
I’m using a pages field in the site.yml and try to show subpages of the type “C”:
sections:
...
content:
type: fields
fields:
list:
type: pages
headline: My Topics
status: all
query: site.find('c')
The structure is as follows: A (parent) → B → C
No matter what I enter on query, it always returns empty, also with page.children, pages.find etc.
Am I missing something here? It also doesn’t work for other types, not only “C”, also doesn’t work with “B” e.g.
Do you really want a field here? If you want to show all subpages (vs. having a field to select some), a pages section would be the right approach.
A section doesn’t have a query
option, though, but a parent
property.
Your query doesn’t work, because site.find()
will only find first level pages. So either use site.index.find('c'), or use
kirby.page(‘a/b/c’)`.
thanks for your reply @moonwalk !
unfortunately iI still get no results: "no pages selected yet and when I click on it it says “Your query must return a set of pages”, no matter if I use site.index.find(‘a’) (b or c) or with kirby.page(‘a/b/c’)
is there anything else I need to make it work?
texnixe
November 10, 2021, 8:32pm
4
If the query returns an error, then the page you are trying to find doesn’t seem to exist.
Both
site.index.find('c')
or
kirby.page(‘a/b/c’)
The first only if the page in question is not a draft, kirby.page()
will also find drafts.