5

In my site when someone access directly the domain.com or any other url that does not contain country indication like domain.com/contact, the language content is shown based on his IP. for example if he lives in UK, he will get the included UK translated file. Likewise, if lives in Italy and access directly the domain.com or domain.com/about will get the IT translations.

After this first visit, all other links are built based on country, meaning domain.com/it/faq and I save the language in a session.

So basically, urls without country will load the language file based on IP. If the criteria are not met, the UK language file will be loaded as a default.

This is how my hreflang looks

<link rel="alternate" href="domain.com/en/contact" hreflang="en">
<link rel="alternate" href="domain.com/it/contact" hreflang="it">
<link rel="alternate" href="domain.com/contact" hreflang="x-default">

Question:

In my country is more often to use a mix of languages on search queries. Should I create a multilingual xml sitemap for better SEO or just create a sitemap with all links in all languages?

Is this the way to do this?

<url>
    <loc>https://www.domain.com/what-we-do</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.domain.com/what-we-do" />
    <xhtml:link rel="alternate" hreflang="en" href="https://www.domain.com/en/what-we-do" />
    <xhtml:link rel="alternate" hreflang="it" href="https://www.domain.com/it/what-we-do" />
</url>

UPDATE AFTER MIKE SUGGESTION

<url>
    <loc>https://www.domain.com/our-work</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.domain.com/en/our-work" />
    <xhtml:link rel="alternate" hreflang="it" href="https://www.domain.com/it/our-work" />
</url>
6
+50

You're better off creating a multilingual sitemap, just to avoid any source of confusion. The format you have shown is correct.

In fact, you could even drop the hreflang declarations in your page sections and just use the declaration within the sitemap.

The Official Webmaster Tools blog explains the advantages of using the multilingual sitemaps declaration rather than on page: http://googlewebmastercentral.blogspot.co.uk/2012/05/multilingual-and-multinational-site.html - one advantage I would add to it is that it's also easier to maintain consistency and avoid missing out on declaring hreflang on new pages etc.

Oh, and don't forget to declare the encoding and the xhtml namespace like: xmlns:xhtml="http://www.w3.org/1999/xhtml" at the start of your XML sitemap.

  • @Mike Google specifically introduced x-default for situations where a language isn't specified or discrenible: googlewebmastercentral.blogspot.co.uk/2013/04/… – FarhadD Jul 12 '15 at 11:13
  • And if your sitemap gets too long, you simply break it up into multiple sitemaps, each of which remains below the limits. I've used perfectly functional sitemaps on websites with millions of pages, where the top-level sitemaps were simply links to thousands of further sitemaps, which were sitemaps for specific product categories. – FarhadD Jul 12 '15 at 11:16
  • You should definitely keep the x-default language declaration in, as I've pointed out above. I've also provided a specific link to Google's announcement about support for x-default if you don't want to take my word on it.! – FarhadD Jul 13 '15 at 12:29
1

In your last example, I'm not sure this will create a benefit in your sitemap:

<xhtml:link rel="alternate" hreflang="x-default" href="https://www.domain.com/what-we-do" />

This is because I don't think "x-default" is a standard language. And besides, you provided the default URL here:

<loc>https://www.domain.com/what-we-do</loc>

It would be better in your case to create and then sort sitemap files by language (a.k.a. go multilingual). Also, create gzipped versions of the sitemaps that you can submit to Google so that Google can use up less of your servers bandwidth when downloading them. The compression is excellent.

I wouldn't recommend listing each link of each language in one or two sitemap files because if your site becomes super huge with say thousands of links in every language, then you'll break sitemap limits of about 50,000ish links per file or 50MB per file.

I'm unsure how big your website is, but you should try to organize your sitemap files as logically as you can.

For example. This setup is illogical especially when doing thousands of links:

File 1:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>http://www.example.com/fr/aboutus</loc></url>
<url><loc>http://www.example.com/en/aboutus</loc></url>
<url><loc>http://www.example.com/de/aboutus</loc></url>
<url><loc>http://www.example.com/gb/aboutus</loc></url>
<url><loc>http://www.example.com/fr/contactus</loc></url>
<url><loc>http://www.example.com/en/contactus</loc></url>
<url><loc>http://www.example.com/de/contactus</loc></url>
<url><loc>http://www.example.com/gb/contactus</loc></url>
</urlset> 

Where as this setup is more logical:

File 1:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>http://www.example.com/fr/aboutus</loc></url>
<url><loc>http://www.example.com/fr/contactus</loc></url>
</urlset> 

File 2:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>http://www.example.com/en/aboutus</loc></url>
<url><loc>http://www.example.com/en/contactus</loc></url>
</urlset> 

File 3:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>http://www.example.com/de/aboutus</loc></url>
<url><loc>http://www.example.com/de/contactus</loc></url>
</urlset> 

File 4:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>http://www.example.com/gb/aboutus</loc></url>
<url><loc>http://www.example.com/gb/contactus</loc></url>
</urlset> 

Then in each html page, include code similar to this as usual:

<link rel="alternate" href="http://www.example.com/en/contactus" hreflang="en">

Search engines should be able to understand the associations between languages through the link tag.

If you submit your site to Google, make sure you submit it to each country version of Google so that all databases will be updated accordingly. Also check googles documentation to make sure the crawler is being taken to the correct version of your site. Check your server logs to make sure of this. If you're unsure which entries come from google, then you will may need to do a whois search on that IP.

  • Hello and thank you for your answer. I understand clearly. Before splitting my sitemap into the countries, please take a look at my updated question where I added an example of the sitemap after removing the x-default as you proposed and tell me if it is right. Also, my page will not be that huge, about 30 pages and 3 countries. – EnexoOnoma Jul 12 '15 at 20:17
  • Your new format looks acceptable. You might want to research short form language codes if you want to add languages because I don't think x-default counts as an official standard language. – Mike Jul 12 '15 at 23:21
  • Google has officially declared the use of x-default for hreflang, so it's perfectly fine. googlewebmastercentral.blogspot.co.uk/2013/04/… (Sorry I couldn't comment directly on here before because I didn't have enough rep) – FarhadD Jul 16 '15 at 9:00

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.