Hey guys! I am finishing up building a small page builder system with Kirby, where subpages in page serve as a building block. However, I have a small problem with that. In Kirby’s CMS, site.com/page/subpage is a separate page, wherein I’d need to redirect it to site.com/page#subpage.
How could I check page intendedTemplate before loading and alter URL loaded based on it? I’ve tried routes, yet unsuccessfully
I use element_ to distinguish builder blocks. However the problem seems to be that if I enable multilanguage and url becomes /en/page/ instead of /page/, let’s say, it doesn’t “catch” the path and returns null
Or maybe my current path is wrong, I’d appreciate ideas
Yes, in multi-language environments your pattern has to catch the language code as well, otherwise it won’t work.
Your pattern is not quite correct, I think, or rather, it depends on your site structure. Currently, it will only catch first level pages, but you want to redirect subpages, not first-level pages. And then it depends if these element subpages are subpages of a first level page or if they can also be further down the tree
You can fetch anything with the (:all) pattern. But I’d start at the second level, because the first level is not affected, so that would be (:any)/(:all) plus the language code.
Do you use the language code for all languages? Or do you omit it for the default language?