From e0368de59a10a047d4e3103fd64c73acc45dd0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 11 Aug 2023 16:06:51 +0200 Subject: [PATCH] Ignore urls with queries --- src/Lib/Sitemap.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Lib/Sitemap.php b/src/Lib/Sitemap.php index 9a35485..311f8fc 100644 --- a/src/Lib/Sitemap.php +++ b/src/Lib/Sitemap.php @@ -36,7 +36,14 @@ class Sitemap // Ignorer le tag dans tout les cas. return null; } - })->filter(); + })->filter(function (?Tag $tag) { + $queries = \collect(\parse_url($tag->getUrl(), \PHP_URL_QUERY))->filter(); + // ! Ignore null from previous or tags with urls that have Queries. + if (!$tag or $queries->count()) { + return null; + } + return $tag; + }); $this->assignPrioritiesAndFrequencies(); }