Update (sitemap)
This commit is contained in:
@@ -7,19 +7,22 @@
|
|||||||
|
|
||||||
class CustomCrawlProfile extends CrawlProfile
|
class CustomCrawlProfile extends CrawlProfile
|
||||||
{
|
{
|
||||||
|
/** @var callable */
|
||||||
|
protected $callback;
|
||||||
|
|
||||||
|
public function shouldCrawlCallback(callable $callback): void
|
||||||
|
{
|
||||||
|
$this->callback = $callback;
|
||||||
|
}
|
||||||
|
|
||||||
public function shouldCrawl(UriInterface $url): bool
|
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() !== '') {
|
if ($url->getQuery() !== '') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the path is exactly '/'
|
|
||||||
return $url->getPath() === '/';
|
return ($this->callback)($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user