1
0
mirror of https://github.com/flarum/core.git synced 2025-01-17 14:18:33 +01:00

Canonical URL: use UrlGenerator in place of extracting the url from request (#2674)

This commit is contained in:
Ian Morland 2021-03-16 01:43:59 +00:00 committed by GitHub
parent 6e4c75eba6
commit 0e6a60bd5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,7 @@ class Index
$document->title = $this->translator->trans('core.forum.index.meta_title_text'); $document->title = $this->translator->trans('core.forum.index.meta_title_text');
$document->content = $this->view->make('flarum.forum::frontend.content.index', compact('apiDocument', 'page')); $document->content = $this->view->make('flarum.forum::frontend.content.index', compact('apiDocument', 'page'));
$document->payload['apiDocument'] = $apiDocument; $document->payload['apiDocument'] = $apiDocument;
$document->canonicalUrl = $defaultRoute === '/all' ? $this->url->to('forum')->base() : $request->getUri()->withQuery(''); $document->canonicalUrl = $this->url->to('forum')->base().($defaultRoute === '/all' ? '' : $request->getUri()->getPath());
return $document; return $document;
} }