1

So I know that alternative links should be put like the below in a sitemap...

<url>
<loc>http://www.mywebsite.com/lang/french/</loc>
<xhtml:link 
             rel="alternate"
             hreflang="fr"
             href="http://www.mywebsite.com/lang/french/"
             />
<xhtml:link 
             rel="alternate"
             hreflang="en-us"
             href="http://www.mywebsite.com/lang/us/"
             />
<xhtml:link 
             rel="alternate"
             hreflang="en"
             href="http://www.mywebsite.com/"
             />

In the above example the fr version is the <loc>. Do I also need to create a en and en-us block with fr and en / en-us as alternatives?

1

Ok so after some more research it seem you do have to repeat yourself. Found at here.. https://developers.google.com/search/docs/advanced/crawling/localized-versions#sitemap

Example...

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <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>
  <url>
    <loc>http://www.example.com/deutsch/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>
  <url>
    <loc>http://www.example.com/schweiz-deutsch/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>
</urlset>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.