Update (sitemap)

This commit is contained in:
2023-11-29 22:51:58 +08:00
parent 3d0873c5af
commit 60b664324a

View File

@@ -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);
}
}