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
-
Deleting Tags without Penalty?
Hello - We have a site with over 1,000 tags. We added too many and would like a fresh start as they are creating a lot of duplicate pages on the site. What is the best way to go about deleting all of these tags without being penalized by Google? Is there a way to tell Google direclty to stop crawling them? We would prefer to not have that many pages just sit as 404 errors on the site. Thank you.
Technical SEO | | FamiliesLoveTravel0 -
Do URLs with canonical tags get indexed by Google?
Hi, we re-branded and launched a new website in February 2016. In June we saw a steep drop in the number of URLs indexed, and there have continued to be smaller dips since. We started an account with Moz and found several thousand high priority crawl errors for duplicate pages and have since fixed those with canonical tags. However, we are still seeing the number of URLs indexed drop. Do URLs with canonical tags get indexed by Google? I can't seem to find a definitive answer on this. A good portion of our URLs have canonical tags because they are just events with different dates, but otherwise the content of the page is the same.
Technical SEO | | zasite0 -
Should summary pages have the rel canonical set to the full article?
My site has tons of summary pages, Whether for a PDF download, a landing page or for an article. There is a summary page, that explains the asset and contains a link to the actual asset. My question is that if the summary page is just summary of an article with a "click here to read full article" button, Should I set the rel canonical on the summary page to go to the full article? Thanks,
Technical SEO | | Autoboof0 -
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 -
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 -
Canonical tags and internal Google search
Quick question: I want some pages that will have canonical tags, to show up in internal results for a Google site search that's built into the site. I'm not finished with the site, but is it correct to assume that pages with canonical will NOT show up in internal site search results, when powered by Google?
Technical SEO | | EricPacifico0 -
What should I set my domain setting to?
In Google Wemnaster tools, I have the option to set it to either have as default the "www" or without it. What are the pros and cons of one way or the other . . . or is this a way more complicated question/can of worms I have opened?
Technical SEO | | damon12120 -
Canonical Tag
Does it do anything to place the Canonical tag on the unique page itself? I thought this was only to be used on the offending pages that are the copies. Thanks
Technical SEO | | poolguy0