Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Specify compatible parent templates in Blueprint #592

Open
neildaniels opened this issue Aug 5, 2020 · 3 comments
Open

Specify compatible parent templates in Blueprint #592

neildaniels opened this issue Aug 5, 2020 · 3 comments

Comments

@neildaniels
Copy link

In a pages section, you can currently specify a set of templates that can be created. This gets a bit tedious sometimes.

For maybe half of my templates, I tend to think about them as being "compatible" with certain parent templates.

I would like to be able to specify compatible parent templates in a Blueprint.

Example:
Let's say I have an Event template and a Calendar template. The only time I want to see "Event" as a potential subpage template is if it's part of the "Calendar" template. (In other words: I shouldn't see "Event" under hypothetical "Blog" or "Projects" sections.)

@lukasbestle
Copy link
Member

I see why "the other way around" can make more sense semantically. However this would be a performance issue as Kirby would need to read all blueprints each time a page is created to check which blueprints are compatible. If it's just one blueprint that defines which options should be listed, this process is much faster. This is the reason why we currently do it that way.

@neildaniels
Copy link
Author

That's a fair point.

But, in the default case (where a parent Blueprint has not specified and children templates), doesn't every Blueprint get read in order to show its "Template Title" in the "New Page" dialog?

Presumably it's also checking for other options, like if it can be created at all?

I wouldn't expect that checking that one more field is missing or contains the parent template to be particularly intensive.

@lukasbestle
Copy link
Member

You are right! When we parse all blueprints anyway, we might as well check for such a filter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants