Update (sitemap)

This commit is contained in:
2023-11-29 22:44:55 +08:00
parent d8bf8784a6
commit 3d0873c5af
9 changed files with 118 additions and 1 deletions

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