Как вы устанавливаете приоритет для домашней страницы?
Я пробовал много вещей, в том числе:
SitemapGenerator::create('https://www.example.com')
->hasCrawled(function (Url $url) {
if ($url->segment(1) === 'https://www.example.com') {
$url->setPriority(1)
->setLastModificationDate(Carbon::create('2016', '1', '1'));
}
return $url;
})
->writeToFile('sitemap.xml');
}
Удалось найти ответ:
//We set the homepage priority to 1
->hasCrawled(function (Url $url) {
if ($url->segment(1) === env('https://www.example.com')) {
$url->setPriority(1);
}
return $url;
})
//We save the file and redirect to it
->writeToFile('sitemap.xml');
return redirect(url('sitemap.xml'));
Еще лучше:
//We set the homepage priority to 1
->hasCrawled(function (Url $url) {
if (is_null($url->segment(1))) {
$url->setPriority(1);
}
return $url;
})
//We save the file and redirect to it
->writeToFile('sitemap.xml');
return redirect(url('sitemap.xml'));
}