I need a page blueprint which works with the kirby block system but also have a page field above it where I can create new pages which are then subpages of the page.
Here is what I’d like to achieve:
/blueprints/pages/custom.yml
title: Custom Page
sections:
subpages:
label: Pages
type: pages
draft: Draft
listed: Published
fields:
blocks:
type: blocks
label: Content
fieldsets:
- example-block
But it does not work as expected. I managed to have a page field above the blocks field in the panel but I could only select existing pages and not create new ones…
Only for understanding the context, I’d like to have a page which has this structure:
(also in my navigation I’d like to have the page as a dropdown link with all subpages in it)
Section 1: Grid of page links which are generated by a foreach loop out of all created subpages in my blueprint field “subpages”
Section 2,3,4… Blocks, arranged in the panel
What am I doing wrong or is it even possible at all?
Thank you in advance!
Once you start using sections, your additionial fields need to go into a field section, see different types of sections in the docs:
Thank you @texnixe, but is it possible to use the blocks system simultaneously then?
It’s not mandatory for me to use sections.
This has nothing to do with blocks. Blocks are just a field type like any other in this respect.
title: Custom Page
sections:
subpages:
label: Pages
type: pages
draft: Draft
listed: Published
fields: #fields section
type: fields
fields:
blocks:
type: blocks
label: Content
fieldsets:
- example-block
And just for the records: that fields section can be named anything, it doesn’t have to be “fields” literally. In the below example, the fields section is named “content”.
title: Custom Page
sections:
subpages:
…
content: #fields section
type: fields
fields:
blocks:
type: blocks
label: Content
fieldsets:
- example-block
Thank you both, that was exactly what I was looking for. The only thing I noticed was a missing indent below “blocks:” otherwise it throws some errors in the panel:
title: Custom Page
sections:
subpages:
label: Pages
type: pages
draft: Draft
listed: Published
content: #fields section
type: fields
fields:
blocks:
type: blocks
label: Content
fieldsets:
- example-block
Thanks again.
1 Like