0
votes

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?

1
"both have same content - only text is changing": How can they have the same content if the text is changing? Or do you mean they are about the same topic, i.e., translations? - unor
Yes, as content I meant like header, images, footer, complete layout of the website. - debute

1 Answers

1
votes

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>