Add localization to the sitemap.xml

alfonsobries
0
alfonsobries
commented a year ago

What problem does this feature solve?

Currently, it's not possible to add localization to a sitemap.xml in a multilingual site accordingly to the Google recommendations

https://support.google.com/webmasters/answer/189077

What does the proposed changes look like?

The possibility to generate sitemaps like this:

```
<url>
    <loc>http://www.example.com/english/page.html</loc>
    <xhtml:link 
               rel="alternate"
               hreflang="de"
               href="http://www.example.com/deutsch/page.html"/>
    <xhtml:link 
               rel="alternate"
               hreflang="de-ch"
               href="http://www.example.com/schweiz-deutsch/page.html"/>
    <xhtml:link 
               rel="alternate"
               hreflang="en"
               href="http://www.example.com/english/page.html"/>
  </url>
idea
0
alfonsobries
0
alfonsobries
commented a year ago

I just noticed that this package depends on https://github.com/ekalinin/sitemap.js#example-of-indicating-alternate-language-pages, so it's actually possible to add alternate URLs

In case someone wondering we just define the route as:

` { url: 'nosotros', changefreq: 'monthly', priority: 0.9, lastmodISO: moment().format(), links: [ { lang: 'en', url: 'en/about-us' } ] },

0
miteyema
0
miteyema
commented 5 months ago

That's nice if you want to list those pages manually, but what if you are already using nuxt-i18n, can this be generated automatically then?

0
Informations
Feature Request โ€ข Open
#c35 - Created a year ago