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
-
Can I safely delete unused tags??
Can I safely delete unused tags, ones with 0 posts connected to them? Thanks, Mike
Technical SEO | | naturalsociety0 -
Is there a way to set up 301 auto redirects from 404s
some of our pages under a specific website section gets deleted from another data source and we want to resolve the problem of 404s can we set up automated 301 redirects to the main page as soon as one of these pages are deleted
Technical SEO | | lina_digital2 -
Meta tags in Single Page Apps
Since the deprecation of the AJAX Crawling Scheme back last October I am curious as to when Googlebot actually reads meta tag information from a page. We have a website at whichledlight.com that is implemented using emberjs. Part of the site is our results pages (i.e. gu10-led-bulbs). This page updates the meta and link tags in the head of the document for things like canonicalisation and robots, but can only do so after the page finishes loading and the JavaScript has been run.When the AJAX crawling scheme was still in place we were able to prerender these pages (including the modified meta and link tags) and serve these to Googlebot. Now Googlebot no longer uses these prerendered snapshots and instead is sophisticated enough load and run our site.So the question I have is does Googlebot read the meta and links tags downloaded from the original response or does it wait until the page finishes rendering before reading them (including any modifications that have been performed on them)
Technical SEO | | TrueluxGroup1 -
Use hreflang for language and regional URLs
I have implemented hreflang on site, seen here http://www.cobaltrecruitment.com/ but Webmaster Tools is returning loads of errors in the international targeting area..... "'“en-sg"' - unknown language code" and "'“en-ar"' - unknown language code" Can anyone suggest what I need to tell my developers to do? Thanks for your help!
Technical SEO | | the-gate-films0 -
How does link juice flow through hreflang?
We want to use the hreflang tag on our site (direct users searching for the Spanish version of spanishdict.com to spanishdict.com/traductor). Before doing so, we were wondering how link juice flows through hreflang? Any insight or resources on this would be very helpful. Thanks!
Technical SEO | | CuriosityMedia0 -
Multiple H1 tags in Squarespace
Hi. I'm using Squarespace, and I've noticed they assign the page title and site title h1 tag status. So if I add an on-page h1 tag, that's three in total. I've seen what Matt Cutts said about multiple h1 tags being acceptable (although that video was back in 2009 and a lot has changed since then). But I'm still a little concerned that this is perhaps not the best way of structuring for SEO. Could anyone offer me any advice? Thanks.
Technical SEO | | The_Word_Department0 -
Why I am a seeing an error for duplicate content for any categories and tags on my Wordpress blog?
When I look under "Crawl Diagnostics" I see I have 12 errors for duplicate content and there are all from tags and categories. I am assuming that search engines are reading the content in the tags and categories as duplicate. Should I set my categories to "no-index?"
Technical SEO | | brytewire0 -
Internal vs external blog and best way to set up
I have a client that has two domians registered - one uses www.keywordaustralia.com the other uses www.keywordaelaide.com He had already bought and used the first domain when he came to me I suggested the second as being worth buying as going for a more local keyword would be more appropriate. Now I have suggested to him that a blog would be a worthy use of the second domain and a way to build links to his site - however I am reading that as all links will be from the same site it wont be worth much in the long run and an internal blog is better as it means updated content on his site. should i use the second domain for blog, or just 301 the second domain to his first domain. Or is it viable to use the second domain as the blog and just set up an rss feed on his page ? Is there a way to have the second domain somehow 'linked' to his first domain with the blog so that google sees them as connected ? NOOBIE o_0
Technical SEO | | mamacassi0