What do you want to return from the route? I guess you want to return a list of articles with the same tag, right? What is the parent page of those articles? Blog or home?
$page = page('tag:' . $tag);
will not return a page, I’m afraid.
that’s absolutely true.
instead of having
tag:fun returning all articles tagged with
fun, I was looking for a way to have
tag/fun return all articles tagged with
And that is perfectly possible, just not in the way your are trying to achieve this. I ask again, what is the parent page of those articles?
Sorry, I missed that you asked about parent page. That’s something like
The way to go about this is to return the blog page with additional data for the controller, i.e. return the tag as additional data, see the docs: https://getkirby.com/docs/developer-guide/advanced/routing/#actions
$data = [
'tag' => $tag
return array('blog', $data);
In your controller, you can fetch the tag with the fourth parameter: https://getkirby.com/docs/developer-guide/advanced/controllers#arguments-from-the-router, and then filter your articles by that parameter.
Please note that you have to modify the way you link your tags to reflect the new URL scheme.
I’ll try it and let you know of the outcome. Thank you so much!