File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,12 @@ protected function compile(): void
4747 $ container = System::getContainer ();
4848 $ param = $ container ->get (NewsCategoriesManager::class)->getParameterName ();
4949
50+ // Keep the parameter unused, if a target page is set
51+ $ currentPage = $ GLOBALS ['objPage ' ];
52+ $ keepUnused = (int ) $ currentPage ->id !== (int ) $ this ->getTargetPage ()->id ;
53+
5054 // Get the active category
51- if (($ alias = Input::get ($ param )) && null !== ($ activeCategory = NewsCategoryModel::findPublishedByIdOrAlias ($ alias ))) {
55+ if (($ alias = Input::get ($ param, false , $ keepUnused )) && null !== ($ activeCategory = NewsCategoryModel::findPublishedByIdOrAlias ($ alias ))) {
5256 $ this ->activeCategory = $ activeCategory ;
5357
5458 // Set the canonical URL
@@ -57,7 +61,7 @@ protected function compile(): void
5761 if ($ responseContext ->has (HtmlHeadBag::class)) {
5862 /** @var HtmlHeadBag $htmlHeadBag */
5963 $ htmlHeadBag = $ responseContext ->get (HtmlHeadBag::class);
60- $ htmlHeadBag ->setCanonicalUri ($ GLOBALS [ ' objPage ' ] ->getAbsoluteUrl ());
64+ $ htmlHeadBag ->setCanonicalUri ($ currentPage ->getAbsoluteUrl ());
6165 }
6266 }
6367 }
You can’t perform that action at this time.
0 commit comments