Feature request: Add localization to the sitemap

alfonsobries
0
alfonsobries
commented 8 months ago

Currently it's not possible to add localization to a sitemap.xml accordingly to the google recommendations

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

<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>
0
NicoPennec
1.4k
NicoPennec
commented 6 months ago

You can easily add alternate language pages with the links attribute:

    routes() {
      return [{
        url: '/english/page.html',
        links: [
          { lang: 'de', url: '/deutsch/page.html' },
          { lang: 'de-ch', url: '/schweiz-deutsch/page.html' },
          { lang: 'en', url: '/english/page.html' }
        ]
      }]
    }

see doc:

0
Informations
Question โ€ข Unresolved
#c34 - Created 8 months ago