Files
aibuddytool/app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php
2023-11-29 22:44:55 +08:00

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() === '/';
}
}