From 0e6a60bd5b364b3d4325b4d2489175e2bc635d3f Mon Sep 17 00:00:00 2001 From: Ian Morland Date: Tue, 16 Mar 2021 01:43:59 +0000 Subject: [PATCH] Canonical URL: use UrlGenerator in place of extracting the url from request (#2674) --- src/Forum/Content/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forum/Content/Index.php b/src/Forum/Content/Index.php index f5a80eade..a93eedbbe 100644 --- a/src/Forum/Content/Index.php +++ b/src/Forum/Content/Index.php @@ -89,7 +89,7 @@ class Index $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->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; }