How To Implement The hreflang Element Using XML Sitemaps
After much confusion and frustration from multilingual site webmasters on how to properly use the hreflang element, Google announced new functionality to allow multilingual and multinational site owners to set the rel=”alternate” hreflang=”x” link annotation using XML sitemaps.
This is a much better way of implementing it than telling webmasters to add hundreds of lines of code to their pages while simultaneously telling them to reduce lines of code.
Help For Multiple Language Countries
There are countries like Canada, Switzerland and Belgium that have multiple national languages and/or large populations that speak different languages resulting in companies creating specific language versions for these markets.
Previously, we had no way to set both a country and languages since Webmaster tool’s Geographical Settings were for countries only.
For example, Switzerland we could only tell Google that the German, French and Italian versions of the site were all related to Switzerland but not designate a language for them.
With this new functionality, we now have the ability to designate a section of the site for the German speaking part of Switzerland and another part of the French speaking. We can easily do this by adding these entries to the XML sitemap or by using the link element as Google initially deployed.
To make the entry for Switzerland,we would add the following to our XML site map.
Companies should deploy a specific XML sitemap with their country homepages as soon as they can to start benefiting from this location setting especially with their English and Spanish sites. Note, you can incorporate this into your normal site map process later but for now you can get it live and reap the benefits.
As the image below shows, simply take your global homepage then create an entry for each of the country/language versions which will help Google understand that they are actual local market versions.
The frustrating thing for me as that most multinationals have already told Google this same information via their Webmaster Tools Geographical targeting function which Google seems to be totally ignoring.
Global & Local English Pages
Many multinational have used their global site as their US site, which has forced them to either, make it US only or global and thereby causing problems in English markets like the UK and Australia.
Using the hreflang element, multinationals can easily designate the global page as being global English [en] and then designate the local market versions as being local-language specific.
Some initial tests show that it has helped some of those sites that are penalized by having multiple English versions of the site in different countries.
XML Sitemap Code Bloat
The size of the XML sitemaps will be a challenge for multinationals when they add these elements since they will expand significantly.
Typical entries use between one to six rows in a XML file, but now they will grow to as many as 100 or more for each URL which needs to be taken into consideration when building them due the max size limitations.
While Sitemap.org standards say the max size is 50,000 URL’s we have found that 5k to 10k URL’s is a more manageable number and we will have to reduce the number of URL’s included further to accommodate the increased file sizes that come with adding all of the hreflang versions making the management of site maps and index files a bit more complicated.
XML Sitemap Development Tools
None of the popular XML site map tools have added this functionality yet but I suspect some of them will. This will be a pretty complex undertaking since you will need to match pages to each other and then make the entries.
For many companies that have uniform URL structures, this will be easy to replicate but for others that have Frankenstein sites as in one case the company had 57 different URL versions to represent the same page in multiple countries.
Until the tools evolve, you can develop these manually for the biggest opportunity markets and your most important content. Hopefully this will be the solution to this massive problem of local content wrapped multinational sites scale being given the same relevance treatment as smaller single country sites.
Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.