I’ve been having an issue with using subpage builder to build a specific module. Imagine I have a module called ‘test’, with the module template ‘module.test’. To create a new module using Subpage Builder, I would do this:
build:
- title: Test
uid: modules/test
template: module.test
This works, however, you end up with a nasty error and not allowing you to continue. If you reload the page, the page and the module are created nonetheless.
I’ve been using Modules Builder to take care of building the Modules for specific modules. It probably has something to do with the fact that maybe the route it addresses gets executed after Kirby tries building the subpage? Anyone with experience building this?
Well, it is not indended to work like that. You would need one blueprint that creates the modules folder (the page blueprint), and then for the module subpage a blueprint that creates the submodule pages.
So this:
build:
- title: Test
uid: test
template: module.test
It kinda works because there’s a hook creating the modules subfolder, before (?) the subpage builder gets initiated. It’s only the panel that’s not up to speed of what’s happening in the background (hence the error).
Having to put it ‘the right way’ would mean the modularity of the modules concept goes lost. I could just put in a few modules in any blueprint and let the panel create them in the background.
for each type of page that needs different modules, give those modules subpages another blueprint. Then in that modules_type1.yml define what modules should be created.
put the modules directly into the page folder without the modules subpage
I get that! I’m happy that it works in most cases. Because most modules in this project are either interfaces for functions or snippets, I’ll solve it in another way.