I have this GenerateSitemap.php file where I can configure the crawler, but I don't understand how I should make the crawler remove some specific URLs for example (https://example.com/?page=1) (https://example.com/?page=10) (https://example.com/?page=125). I use spatie in laravel for this solution and try below solution but it didn't work
public function sitemap()
{
SitemapGenerator::create('https://example.com')
->shouldCrawl(function (UriInterface $url) {
return strpos($url->getPath(), '?page') === false;
})
->writeToFile(public_path('sitemap.xml'));
}