From 5904418e8d78c0657598d5dceba69822cbfdf698 Mon Sep 17 00:00:00 2001 From: Charles Teh Date: Wed, 29 Nov 2023 23:02:23 +0800 Subject: [PATCH] Add (custom crawl profile) --- .../SitemapCrawler/CustomCrawlProfile.php | 28 +++++++++++++++++++ config/sitemap.php | 3 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php diff --git a/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php b/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php new file mode 100644 index 0000000..5b231f5 --- /dev/null +++ b/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php @@ -0,0 +1,28 @@ +callback = $callback; + } + + public function shouldCrawl(UriInterface $url): bool + { + if ($url->getQuery() !== '') { + return false; + } + + + return ($this->callback)($url); + } + +} diff --git a/config/sitemap.php b/config/sitemap.php index 69be0f3..2007c5e 100644 --- a/config/sitemap.php +++ b/config/sitemap.php @@ -1,5 +1,6 @@ Profile::class, + 'crawl_profile' => CustomCrawlProfile::class, ];