26 lines
617 B
PHP
26 lines
617 B
PHP
<?php
|
|
|
|
namespace App\Helpers\FirstParty\SitemapCrawler;
|
|
|
|
use Spatie\Crawler\CrawlProfiles\CrawlProfile;
|
|
use Psr\Http\Message\UriInterface;
|
|
|
|
class CustomCrawlProfile extends CrawlProfile
|
|
{
|
|
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() === '/';
|
|
}
|
|
}
|