From f7d45feda49ef70c0ca6b25274a4f473b8aaf842 Mon Sep 17 00:00:00 2001 From: Nicolas Barbey Date: Tue, 1 Oct 2024 15:21:51 +0200 Subject: [PATCH] fix pagination --- Config/module.xml | 2 +- EventListener/CanonicalUrlListener.php | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Config/module.xml b/Config/module.xml index a54516e..68a9a00 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -13,7 +13,7 @@ en_US fr_FR - 2.1.7 + 2.1.8 Gilles Bourgeat diff --git a/EventListener/CanonicalUrlListener.php b/EventListener/CanonicalUrlListener.php index 3d91513..f40accc 100644 --- a/EventListener/CanonicalUrlListener.php +++ b/EventListener/CanonicalUrlListener.php @@ -88,10 +88,7 @@ public function generateUrlCanonical(CanonicalUrlEvent $event): void $canonicalUrl = rtrim($canonicalUrl, '/'); $view = $request->get("_view"); - if(in_array($view, ['category', 'folder'])) { - if (null === $page = $request->get('page')){ - $page = 1; - } + if((null !== $page = $request->get('page')) && in_array($view, ['category', 'folder'])) { $canonicalUrl .= '?page='.$page; }