HREFLANG Tool - create your XML site map

A brief explanation about the HREFLANG tool, it's uses and a clear way to get started. Simply upload your CSV file and we'll do the rest!

How to use the HREFLANG tool

One of the biggest difficulties with international SEO is the successful targeting of the correct website to the correct region, so that search users in a particular region find the site that is aimed at them.

One extremely useful solution to this problem are rel=”alternate” hreflang=”x” XML sitemaps. This lets you tell Google what versions of your content you want to have showing up in search results for various targeted regions/languages, which is particularly effective when you have one powerful website ranking in all regions, despite having specifically targeted pages/sections for that area/language.

After doing a lot of research and work for implementing rel=”alternate” hreflang=”x”, which we documented in this blogpost, we created an XML sitemap generator to help assist others with the implementation of this work.

Users of this tool are assumed to have a good grasp of rel=”alternate” hreflang=”x” and already have a map of what equivalent pages they want to be targeting for each specific region.

Usage Instructions

This tool allows you to upload a CSV (comma separated values) file with a map of your pages targeted to each specific region/language to create your rel=”alternate” hreflang=”x” XML sitemap.

Each column header needs to contain the country and language code – i.e. for an English language, internationally targeted site, it would be “en“, English Language for British users it would be “en-gb“, whilst English language for Australian users would be “en-au“. For a more comprehensive list of languages, the Wikipedia has a List of ISO 639-1 codes, whilst the country codes for regions are also found on the Wikipedia - ISO 3166-1 alpha-2.

See the Google guidelines on rel=”alternate” hreflang=”x” and Sitemaps: rel=”alternate” hreflang=”x” for more info.

The first column of the CSV needs to have the URLs from the website that this sitemap will be uploaded to (as this will be the “location” that the equivalents are marked against).

The next columns will have a reference to the URL most suitable for the region/language specified in the column header.

You need to have a list of URLs, with their equivalents for each region all on the same rows within this csv, like the example URL map below:

Example URL Mapping

Each row should then contain the relevant links from each website (see above) - we don't recommend leaving any blanks in place - each row must have an element for each country supplied.

Please note that each row must have an element for each country supplied.

Save the file as a CSV (.csv) and upload using the form.

We've updated the tool for the new website and there have been a few slight changes since version 1 if you've used this before.

You'll be emailed with a link to a combined version of the file (for sub folder implementation of hreflang on one domain) and individual sitemaps for individual domains or sub domains.

If you get stuck with this at all, just tweet @theMediaFlow

Creating your sitemap

Simply upload your CSV file and we'll do the rest!

Peter Handley
Peter Handley