Hi everybody,
I am working on a page with kirby and needed to redirect a parent path to a random subpath. That works pretty well, thanks to the help of a post in this forum.
The snippet of my config file looks like this:
'routes' => [
[
'pattern' => 'de/Schmuck',
'action' => function () {
$albums = page('Schmuck')->children()->keys();
return go($albums[array_rand($albums)]);
}
],
[
'pattern' => 'en/Schmuck',
'action' => function () {
$albums = page('Schmuck')->children()->keys();
return go($albums[array_rand($albums)]);
}
],
]
Unfortunately with this configuration every subpath which contains “de/Schmuck” links to a random child.
Example: mypath/de/Schmuck/category:Ringe redirects also to a random child of Schmuck. Is there any way to limit the pattern just to these specific path?
Thank you so much for you help! You’re support is awesome