You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like these parts of the README file are the same. I want to see the documentation how to use addAlternate for multiple languages.
Manually adding links
You can manually add links to a sitemap:
use Spatie\Sitemap\SitemapGenerator;
use Spatie\Sitemap\Tags\Url;
SitemapGenerator::create('https://example.com')
->getSitemap()
// here we add one extra link, but you can add as many as you'd like
->writeToFile($sitemapPath);
Adding alternates to links
Multilingual sites may have several alternate versions of the same page (one per language). Based on the previous example adding an alternate can be done as follows:
use Spatie\Sitemap\SitemapGenerator;
use Spatie\Sitemap\Tags\Url;
SitemapGenerator::create('https://example.com')
->getSitemap()
// here we add one extra link, but you can add as many as you'd like
->writeToFile($sitemapPath);
Note the addAlternate function which takes an alternate URL and the locale it belongs to.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Looks like these parts of the README file are the same. I want to see the documentation how to use addAlternate for multiple languages.
Beta Was this translation helpful? Give feedback.
All reactions