Ad

Sitemap For Multilingual Website With Customized Links

- 1 answer

My website has language code in every URL link, depends on which language user is using. So, for example, for english users the website link can be: http://example.com/en/articles/ and for slovak users it can be http://example.com/sk/clanky/.

So there are two different links, but both have same content - only text is changing. Sitemap.xml should has http://example.com/en/articles/, but how can I make sitemap for both languages? What happens, when both links will be in the same sitemap.xml file?

Ad

Answer

Simply add all your links in the sitemap and add the hreflang to it

EX :

<?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/deutsch/</loc>
    <xhtml:link rel="alternate" hreflang="en" target="_blank" rel="nofollow noreferrer" href="http://www.example.com/english/" />
    <xhtml:link rel="alternate" hreflang="de-ch" target="_blank" rel="nofollow noreferrer" href="http://www.example.com/schweiz-deutsch/"/>
    <xhtml:link rel="alternate" hreflang="de" target="_blank" rel="nofollow noreferrer" href="http://www.example.com/deutsch/" />
  </url>
</urlset>

In the hreflang you can specify the language and the country for your content.

Or you can add all your links without the hreflang

<?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/deutsch/</loc>
    </url>
    <url>
        <loc>http://www.example.com/english/</loc>
    </url>
    <url>
        <loc>http://www.example.com/arabic/</loc>
    </url> 
</urlset>
Ad
source: stackoverflow.com
Ad