Repository navigation
Replies: 2 comments
|
Have you figured it out by now? SitemapGenerator::create(config('app.url'))
->getSitemap()
->add(
Url::create(route('en.home'))
->setLastModificationDate(now())
->addAlternate(route('nl.home'), 'nl'));
->writeToFile(public_path('sitemap.xml'));Change the |
0 replies
|
I use something like this right now: SitemapSpatie::create()
->add(
collect($chunk)->map(function ($url) {
$link = Url::create($url);
foreach ($languages as $lang) {
$link = $link->addAlternate(
LaravelLocalization::localizeUrl($url, $lang),
$lang
);
}
$link = $link->addAlternate(LaravelLocalization::localizeUrl($url, $lang), $lang);
$link = $link->addImage(asset("path_to_image"));
return $link;
})->toArray()
)
->writeToFile($sitemapPath); |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Looks like these parts of the README file are the same. I want to see the documentation how to use addAlternate for multiple languages.
All reactions