From f5e949bbd8f520c45ab36b1587f19d2df6c0683a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Mon, 22 May 2023 16:12:45 +0200 Subject: [PATCH] Add default ignore routes --- src/Lib/SitemapGenerator.php | 9 +++++++++ src/Traits/SitemapRouteConditions.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Lib/SitemapGenerator.php b/src/Lib/SitemapGenerator.php index ee24c46..052452e 100644 --- a/src/Lib/SitemapGenerator.php +++ b/src/Lib/SitemapGenerator.php @@ -23,6 +23,15 @@ final class SitemapGenerator /** @var \Spatie\Sitemap\Sitemap */ private $siteMap = null; + /** + * Default routes to ignore + * + * @var string[] + */ + private static $defaultIgnoreRoutes = [ + 'ignition.' + ]; + /** * SitemapGenerator */ diff --git a/src/Traits/SitemapRouteConditions.php b/src/Traits/SitemapRouteConditions.php index 6c343f1..2aef3ea 100644 --- a/src/Traits/SitemapRouteConditions.php +++ b/src/Traits/SitemapRouteConditions.php @@ -36,7 +36,7 @@ trait SitemapRouteConditions throw new \Error('ignoreRoutes can take only string with route name or url'); } return $value; - }); + })->concat(static::$defaultIgnoreRoutes); self::$queryConditions = \collect(\config('refresh-sitemap.queryConditions', self::$queryConditions)) ->mapWithKeys(function ($value, $index) { if (!\is_string($index) or !(\is_string($value) || \is_bool($value))) {