diff --git a/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php b/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php index f87839c..5b231f5 100644 --- a/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php +++ b/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php @@ -7,19 +7,22 @@ class CustomCrawlProfile extends CrawlProfile { + /** @var callable */ + protected $callback; + + public function shouldCrawlCallback(callable $callback): void + { + $this->callback = $callback; + } + public function shouldCrawl(UriInterface $url): bool { - // Check if the host is not 'localhost' - if ($url->getHost() !== 'localhost') { - return false; - } - - // Check if there are query parameters in the URL if ($url->getQuery() !== '') { return false; } - // Check if the path is exactly '/' - return $url->getPath() === '/'; + + return ($this->callback)($url); } + }