I am currently usiing Mezzio and having an issue using url helpers while trying to create canonical links for a blog page (hopefully can explain this properly):
I have the following code in the view:
$this->headLink([
‘rel’ => ‘canonical’,
‘href’ => $this->serverUrl($this->url(‘blog.list’))
], ‘PREPEND’);
The following route:
$app->get(
‘/blog/[category/{category:[a-zA-Z][a-zA-Z0-9_-]*}]’,
Blog\Handler\ListPageHandler::class,
‘blog.list’
);
The url works fine when visiting /blog/ and returns /blog/, however when visting /blog/category/videos the url returned in the helper is /blog/category/videos and should return /blog/
It’s as if the helpers are automatically populating the route params somehow? Is this a bug or intended functionality?