Patrik Krehák
Patrik Krehák

Reputation: 2683

Sitemap for multilingual website with customized links

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?

Upvotes: 0

Views: 910

Answers (1)

Nadeem Haddadeen
Nadeem Haddadeen

Reputation: 469

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" href="http://www.example.com/english/" />
    <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/"/>
    <xhtml:link rel="alternate" hreflang="de" 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>

Upvotes: 1

Related Questions