Custom fields/blueprint for subpages

Hello, this is my first post. Just wanted to say the guys behind Kirby CMS have done a great job.

I am working on a project where I need subpages to have different panel fields than the parent page. How would I use a different blueprint for subpages? For info: both the parent and sub page will use the same template.

If you use a different blueprint for the subpage than for the parent, the name of the text file will be different. And since the template to be used is determined by the name of the text file, this will not work out (unless you want to use the default.php template for this purpose (not really recommendable)).

What is the reason for using the same template if the fields are different and ergo the code has to be different?

1 Like

Thanks for reply.

I am using the same template to avoid reusing code. The parent and and sub page are very similar. E.g with same title, description and submenu (child links). However, the subpages will have fields that determine content (from JSON) at parent/subpage. The parent doesn’t need these same fields.

Instead of using the same template, you could put the reusable code into snippets that you call in both templates.

1 Like

Ok are you saying I should use different templates for parent and sub pages (so they use different blueprints), but use snippets for shared code?

Exactly, I don’t see any other solution that makes sense.

1 Like

Ok thanks, will give that a go.