1
0
mirror of https://github.com/flarum/core.git synced 2025-08-10 18:35:56 +02:00

Canonical URL: Use UrlGenerator in place of extracting the url from request (#122)

This commit is contained in:
Ian Morland
2021-03-16 01:44:22 +00:00
committed by GitHub
parent 4ff74d3289
commit 1b339267f8

View File

@@ -94,7 +94,7 @@ class Tags
$document->title = $this->translator->trans('flarum-tags.forum.all_tags.meta_title_text'); $document->title = $this->translator->trans('flarum-tags.forum.all_tags.meta_title_text');
$document->meta['description'] = $this->translator->trans('flarum-tags.forum.all_tags.meta_description_text'); $document->meta['description'] = $this->translator->trans('flarum-tags.forum.all_tags.meta_description_text');
$document->content = $this->view->make('tags::frontend.content.tags', compact('primaryTags', 'secondaryTags', 'children')); $document->content = $this->view->make('tags::frontend.content.tags', compact('primaryTags', 'secondaryTags', 'children'));
$document->canonicalUrl = $defaultRoute === '/tags' ? $this->url->to('forum')->base() : $request->getUri()->withQuery(''); $document->canonicalUrl = $this->url->to('forum')->base().($defaultRoute === '/tags' ? '' : $request->getUri()->getPath());
return $document; return $document;
} }