Locale-adaptive pages

Today I read that Google are going to change the way there Googlebot is crawling sites. They are going to crawl webpages from IP addresses that are not from USA as they do today. Why, or who cares could be many webmasters response. Well, there are many websites that change their content language depending on where the user come from.

Example: If a user visit the site from an IP address that are located in Sweden the content will be presented on the page in Swedish. So if the Googlebot is crawling the site from USA the content will be in English.

The negative side of this is that Google will only crawl the English content and in the end only index English pages. In the other hand, this type of functionality is not recommended. So even if Google from now on will crawl and reach more content on these websites we strongly suggest to change the logic.

The logic that should be used is to have unique URLs to these different pages. Let’s say that you have a page that are in English and Swedish. The URLs could be for example:

  • English: /mypage
  • Swedish: /minsida

If you should only do that, Google will find 2 pages and hopefully index both of them. But it is the same page. How could I tell Google that this is the same page but with 2 language presentations? Well there is a HTML tag that can be used that describes for search engines that the page you visiting exist in other translations. The tag we are talking about is rel=alternate hreflang annotations.

To be a little more practical we could describe how to implement that like this. In both pages HTML head you should add:



<link rel="alternate" hreflang="en" href="http://yourdomain.com/mypage" />

<link rel="alternate" hreflang="sv" href="http://yourdomain.com/minasidor" />



That will describe for Google that the page has a translated version. It will also give the possibility for user in Sweden to send a URL to a friend in USA and they will see the same content/translation and not different because of their IP addresses. Make sure to implement the rel=alternate hreflang links on both pages, otherwise Google will ignore it. Also check that you use the correct culture codes in the hreflang attribute.