skip to Main Content

Hreflang Tags Usage for Localization

Hreflang Tags

The Hreflang tags were first introduced by Google in December of 2011, and they were designed to allow site owners to show the relationship between pages of similar content, but in different languages. This is to help the search engines to serve the correct results to users searching in a specified language.

For example, if you create a English-language version of your Spanish-language homepage, you would tag it as “English” by using hreflang=”en” so that searchers with an IP address that a search engine has reason to believe is in a English-speaking country are served that page in English instead of the Spanish version. This can reduce your bounce rate and improve your conversions by ensuring your target audience lands on the version of your page most suitable for them.

Here is how you would write that tag:

<link rel="alternate" href="http://myenglishhomepage.com" hreflang="en-us"/>

The “en” in the hreflang tag means English and the “-us” is the regional identifier, United States. If your content was targeting English-speakers in London, you would use “en-gb”, for Great Britain. However, you are not required to use the regional identifier. Here is another example of proper implementation.

<link rel="alternate" href="http://myenglishhomepageinamericanenglish.com" hreflang="en-us"/>
<link rel="alternate" href="http://myfrenchhomepage.com" hreflang="fr"/>
<link rel="alternate" href="http://myitalianhomepage.com" hreflang="it"/>
<link rel="alternate" href="http://myspanishomepageinmexicanspanish.com" hreflang="es-mx"/>

HREFLANG Tags Plugin for WordPress

As you can tell, this is easy to implement if you have a static HTML site. But, for us users of WordPress, it is much harder. Since most themes contain a single header.php file where all of the content in the <head> is placed, you can imagine how this would be a problem. If you were to paste the above code in the <head> section in header.php then what you are effectively telling the search engines is that every single post and page in my site has an alternative link which points to the homepage of that site. This is wrong and will hurt your rankings and not help.

So, what we have done is to create a small, light-weight plugin that effectively handles your hreflang tags on a per-page, per-post basis. Here is how it works:

  1. Go to Plugins -> Add New and search for “HREFLANG Tags”. Our plugin is currently the 1st result and looks like this: hreflang tags search result
  2. Go ahead and click Install Now to install our plugin.
  3. Go to the Page or Post that you want to add hreflang tags on and go to the Edit Post screen. Towards the bottom of the screen you will see a new meta box named “HREFLANG Tags”. Here you will see an input box for Alternative URL and a dropdown select for Language. You can add as many as required for your page. Then click Update to update the page/post as usual.

That’s it. It’s really that simple to use.

If you have any questions or concerns regarding this plugin, or would like to see new features for this plugin, feel free to contact us using this form, or you may call us at +63 44 769 4023 or Skype us at dcgws_internet_solutions. If you would like us to create a specific plugin for your WordPress site, you may request a quote.

This Post Has 16 Comments

  1. Hi. Just thought I’d let you know the instruction video on hreflang lite has no audio.
    I accessed it from a couple of locations with the same result.

    1. Hi Thomas

      Thank you for your comment. We intentionally created the video without audio, since so many of our customers are not English-speaking. I will try to provide multilingual captions at some point in the future.

      Did you have a particular question that I could help you with?

      Best,
      David

      1. I’m editing a post for Aust English, and already have a similar post that I intend to direct to US users. I assume I enter en-au in the box? How do I show that it’s related to the other post?
        I’m worried about duplicate content violations.
        Do I need to specify a default language for other posts or pages?

  2. Both posts should have tags.

    For example, on your en-au post:
    <link rel="alternate" href="/post-en-au/" hreflang="en-au"/>
    <link rel="alternate" href="/post-en-us/" hreflang="en-us"/>
    <link rel="alternate" href="/post-en-au/" hreflang="en"/> (if the AU is your main page)

    Then on your en-us post:
    <link rel="alternate" href="/post-en-au/" hreflang="en-au"/>
    <link rel="alternate" href="/post-en-us/" hreflang="en-us"/>
    <link rel="alternate" href="/post-en-au/" hreflang="en"/>

    Hope this helps.

  3. Hi David.
    On re-reading the documentation, I think I should be using the US post as the alternative on the AU post, and vice versa. This seems to make sense to me.
    Sorry, I realise you’re a busy man, but can you confirm this for me?
    Also, how do I check that the tags are implemented properly?
    Thanks again, Thomas.

  4. Hi again.
    If I opt to buy the pro version, do I have to buy one for each website I have? (I have 5 altogether)
    What is the price?

    1. You’re very welcome and thank you, as well. I hope to get some free time over the holidays and I’ll look it over well.

      Thanks again

  5. Hi David,

    I am missing a lot of en languages in $hreflanguages. For example I need en for India, Singapore, Germany and many more.
    I can update variables.php file, but all my updates will be gone with next plugin update. Do you thing it is good idea to create custom function in function.php for loading custom hreflang values into $hreflanguages array?

    Thanks

  6. Hi there, is there another free plugin that you could recommend to manage hreflang tags? I am building a website Professional photography service in San Juan & Carolina, Puerto Rico (http://momentstopper.com) for photography service in Puerto Rico and I am willing to make it bilingual: English/Spanish. Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top