Apologies for a simple question, but what is the best way to show a specific page (chosen by name or template, say), in the site blueprint?
I have the below, which will show the subpages of ‘info’.
info:
type: pages
status: listed
parent: site.find(“info”)
But if I just want to show the info page and not its children, how do I do that?
Or if I wanted to list a few specific pages (‘info’, ‘contact’ and ‘faq’, for example) is there an easy way to do that?
The only way to filter pages in a pages section is by template and status
sections:
mysection:
type: pages
status: listed
template: xyz
Or multiple templates
sections:
mysection:
status: listed
type: pages
templates:
- a
- b
- c
See Pages section | Kirby CMS
If that doesn’t work for you, you need the pages section plugin which allows you to use a query: GitHub - rasteiner/k3-pagesdisplay-section: K3 plugin: display any page list in a section. Any parent, many parents, filtered, don't care.
1 Like
Ah, thank you, that’s really helpful (and quick!).
This doesn’t work for me:
sections:
mysection:
status: listed
template: xyz
(I get ‘invalid section type’.)
And this doesn’t work:
sections:
pages:
mysection:
status: listed
template: xyz
(It lists all the pages, regardless of template.)
But this does work:
sections:
pages:
status: listed
template: xyz
So problem solved, though I’m not sure I completely understand the logic at work? But thank you again!
I was a bit lazy and forgot to add the section type. Your second example works because there is some magic at work with the section name pages
, which doesn’t work if the section has a different name.