I’m a new kirby user and it works amazing and everything is so well documented, thanks for creating such a great and simple cms.
Here is the problem I’m having currently … I’d like to kill the parent category in the url to make it more flat and simplify it. Basically I’d like to remove the parent category page.
This is how it usually is:
domain.tld/projects/project-a
This is how I’d like it to be:
domain.tld/project-a
I tried this snippet for the config file but it doesn’t work…
I have another problem that I can’t seem to figure out. The below code works great, but I added another layer on top which breaks then the route if you navigate to the lowest level.
it should all output to …
/projects
/project-a
/project-b
The request path is not so useful here, because it only consists of this one variable we get from the placeholder.
What you need. instead is an array of possible pages you can loop through, rather than typing them all out.
For example, get the. index of the projects folder:
$uris = page('projects')->index()->pluck('uri');
This gives you a list of page URIs you can loop through to compare with the page in. the pattern.
If you have a lot of categories that might be worth it.
Keep in mind that you really have to be careful with this URL flattening approach and make sure that none. of the subpages in any of your category folders have the same. UID.