Update (sitemap)
This commit is contained in:
25
app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php
Normal file
25
app/Helpers/FirstParty/SitemapCrawler/CustomCrawlProfile.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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() === '/';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user