Setting up hreflang tags
-
Hi everyone,
A quick question about setting up your Hreflang tags. Here you can see 2 examples:
As you can see, the order of the elements is different. Be aware, there is a tiny difference between the 2: the first Hreflang is written for a specific language in a specific country, the second one only contains a language code.
Is this the reason why the order is different or is this just a coincidence and doesn't the order of the elements matter at all?
Thanks,
Jens -
Always is pleasure to help : )
-
Ok good to know!
Thanks for your answer Roman!
-
The order of the of the tag is not relevant as long you follow the rules for region, language, or country The link will need to have the "rel", "href" "hreflang" tags. So if you put the href before or after "hreflang" is not relevant.
-
Hi Roman,
Thanks for your answer!
About the order of the hreflangs, I actually ment inside the Hreflang itself.
Is there a difference if the order of the elements is switched:
or
<link=rel="alternate" hreflang="en-us" href="http://example.com"></link=rel="alternate">The content is the same, but the positions "href"="http://example.com" and "hreflang"="en-us" are switched.
Do you know if it matters? Which one is correctly written then?
Thanks in advance,
Jens -
hreflang tags are a method to mark up pages that are similar in meaning but aimed at different languages and/or regions. You can use this for three types of variations:
- Content with regional variations like en-us and en-gb.
- Content in different languages like en, de and fr.
- A combination of different languages and regional variations.
You can use hreflang tags to target different markets that use the same language. This is a fairly common use case. Using hreflang tags you can differentiate between the US and the UK, or between Germany and Austria.
hreflang is code, which you can show to search engines in three different ways, more on that below. With this code you specify all the different URLs on your site(s) that have the same content. These URLs can have the same content in a different language, or the same language but targeted at a different region.
In a complete hreflang implementation, every URL specifies which other variations are available. When a user searches, Google goes through the following process:
- it determines that it wants to rank a URL;
- it checks whether that URL has hreflang annotations;
- it presents the searcher with the results with the most appropriate URL for that user.
The users current location and his language settings determine the most appropriate URL. A user can have multiple languages in his browser’s settings. I, for instance, have Dutch, English and German in there. The order in which these languages appear in my settings determines the most appropriate language.
One thing is very important when implementing hreflang: don’t be too specific! Let’s say you have three types of pages:
- German
- German, specifically aimed at Austria
- German, specifically aimed at Switzerland
You could choose to implement them using three hreflang attributes like this:
- de-de targeting German speakers in Germany
- de-at targeting German speakers in Austria
- de-ch targeting German speakers in Switzerland
However, which of these three results should Google show to someone searching in German in Belgium? The first page would probably be the best. To make sure that every German searching user who does not match either de-at or de-ch gets that one, change that hreflang attribute to just de. Specifying just the language is in many cases a smart thing to do.
It’s good to know that when you create sets of links like this, the most specific one wins. The order in which the search engines sees the links doesn’t matter, it’ll always try to match from most specific to least specific.
Technical implementation
1. Valid hreflang
The hreflang attribute needs to contain a value that consists of the language, optionally combined with a region.
- The language attribute needs to be in ISO 639-1 List of ISO 639-1 codes
- The region is optional and should be in ISO 3166-1 Alpha 2 formatISO 3166-1 alpha-2
2. Return links
The second basic rule is about return links. Regardless of your type of implementation, each URL needs return links to every other URL, note that it should point at the canonical versions, more on that below. The more languages you have the more you might be tempted to limit those return links: don’t. If you have 80 languages, you’ll have hreflang links for 80 URLs. There’s no getting around that.
**3. hreflang **link to self
The third and final basic rule is about self-links. Just like those return links might feel weird at some point, the hreflang link to the current page feels weird for some developers. It’s required though and not having it will mean your implementation will not work.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Help Setting Up 301 Redirects from Coldfusion Site to Wordpress Site.
I have created a new website and need to redirect all of the previous pages to the new one. The old website was built in coldfusion and the new site is built in wordpress. One of the pages I'm trying to redirect is www.norriseal.com/products.cfm to http://norrisealwellmark.com/products/. This is what I have in my .htaccess file <ifmodule mod_rewrite.c="">Options +FollowSymlinks
Technical SEO | | MarketHubb
RewriteEngine On
RewriteBase /
Redirect 301 /products.cfm http://norrisealwellmark.com/products/</ifmodule> The result of this redirect is http://norrisealwellmark.com/products.cfm How do I prevent the .cfm from appending to the destination URL?1 -
Hreflang and canonical for multi-language website
Hi all, We're about to have a new website in different languages and locations, which will replace the existing one. Lets say the domain name is example.com. the US version will be example.com/en-us/ and the UK version will be example.com/en-uk/. Some of the pages on both version share the same content. So in order to solve it, we're about to use hreflang on each page + a canonical tag which will always use the US address as canonical address. My question is - since we are using canonical tag along with hreflang, is there a possibility that a user who is searching with Google.co.uk will get the canonical US address instead of the UK address? Or maybe the search engine will know to display the right localized address since (UK) i've been using hreflang? It is really important for me to know, because i'm afraid we will lose the high rankings that we have right now on google.co.uk. Thanks in Advance
Technical SEO | | Operad-LTD0 -
Meta description tag problems according to an seo tool
hi, my site is www.in2town.co.uk I am using an seo tool to check on my site and how to improve the seo. The tool is here. http://www.juxseo.com/report/view/51ebf9deab900 for some reason it has brought up errors, it claims i have not got a meta description even though i have and have doubled checked in my source code the errors it has brought up is as follows, and i would like to know if this is a fault of the seo tool or am i doing something wrong Does the description tag exist?0/1 <a id="sub_toggle_12" class="sub_toggle contract_sub"></a>Hide Info Description Tag: Explanation: The meta description tag does not help your rankings but it is your opportunity to encourage prospects to click. The meta description should describe the content of your web page, include a strong call to action, and include your keyword. Action: Make sure you are using the meta description tag. It is found in the section of your page. checkboxIs there only one description tag?0/2<a id="sub_toggle_13" class="sub_toggle expand_sub"></a>More InfocheckboxIs your description less than 156 characters?0/1<a id="sub_toggle_14" class="sub_toggle expand_sub"></a>More InfocheckboxIs your keyword in the description tag?0/3 <a id="sub_toggle_15" class="sub_toggle expand_sub"></a>More Info it also says about the canocial tag which it claims i have more than one Is the canonical tag optmized? Is there only one canonical tag?0/4 <a id="sub_toggle_10" class="sub_toggle contract_sub"></a>Hide Info Explanation: You only need one of these to direct a search engine. Don't muddy the waters. Action: Make sure you only have one canonical tag. This only applies if you use the canonical tag. any help and advice would be greatregards
Technical SEO | | ClaireH-1848860 -
Google changing title tags to branded
Hi guys and gals, i noticed in the results today Google has been changing my title tags so that brand: is in the front of it all. This is not in the code but my title tag structure site-wide is keywords and then always | brand on the end. Why has this happened does anyone know? does it affect my first keyword in the title tag, i guess Google might do it as it recognises the brand and wants users to know it?
Technical SEO | | pauledwards0 -
Tag archives in wordpress
I have duplicate content issue on my site, because i allow to index tags in my wordpress. And the content overlaps on them. What could be a solution to this? How do i fight it, if still want my tag pages to be indexed in Google, but i don't want to to influence my traffic negatively? Currently i have 596 tags! 🙂 Site:
Technical SEO | | pycckuu
richclubgirl.com My idea was to put canonical tag for the post i want to rank from the most popular tag pages (with biggest page authority). Would love to hear from You!1 -
Examples of sites using hreflang
Hi all, I'll soon be doing some work for a worldwide company who are launching a new site. The new site is a near clone of another of their sites in another country. Obviously I'll need to make use of rel="alternate" hreflang="x" on both sites. I've read all the Google documentation etc but was wondering if you guys could point me in the direction of a few sites which are currently implementing the tag successfully. Thanks in advance,
Technical SEO | | iProspect-Ireland0 -
Why does it take so long for my TITLE tag it show ??
Hi Guys, I am frustrated here! I have changed my title tag so that I get a much better CTR. But I changed it a week ago and it is still howing the old title tag in the SERPS. Can anyone please tell me how long Google can take to show the new title tag in the search results?? Can it take weeks?? Thanks guys Gareth
Technical SEO | | GAZ090 -
Rel-canonical tag
Hi, I'm having some confusion with the rel-canonical tag. A few months ago we implemented the rel-canonical tag because we had many errors specifically duplicate page content come upon the SEOmoz web app (mostly because we use tracking code). I had asked what to do about this and was advised by the SEOmoz web app to implement the rel-canonical tag. However, when I'm working on the Keyword Optimizer Tool, it always checks off that I'm using the rel-canonical tag improperly, and then when I go into our sites' CMS for that page and uncheck "Use Canonical URL", the keyword optimizer tool up's my grade for that correction/that I've made an improvement. So my question is if the page I'm working on is the one I want search engines to find, should I not be using the Canonical URL tag? Should the Canonical URL tag only be used on URL's with the tracking code?
Technical SEO | | aircyclemegan0