A presentation on Google's hreflang, given by Joost de Valk of Yoast at the International Search Summit in Munich. It covers what hreflang is, how to implement it, which pitfalls to avoid and how to keep it working.
5. What is hreļ¬ang?
āGoogle uses the rel="alternate"
hreflang="x" attributes to serve the correct
language or regional URL in Search results.ā
ISS Munich - #iss #hreļ¬ang - @jdevalk
6. What is hreļ¬ang?
In short: serve the right language version to the
user, based on their locale and location.
ISS Munich - #iss #hreļ¬ang - @jdevalk
7. What is it meant for?
ISS Munich - #iss #hreļ¬ang - @jdevalk
8. What is it meant for?
ā¢ Fully translated sites
ISS Munich - #iss #hreļ¬ang - @jdevalk
9. What is it meant for?
ā¢ Fully translated sites
ā¢ Sites with regional variation
ISS Munich - #iss #hreļ¬ang - @jdevalk
10. What is it meant for?
ā¢ Fully translated sites
ā¢ Sites with regional variation
ā¢ Only the template gets translated, main
content is the same (but donāt do this!!)
ISS Munich - #iss #hreļ¬ang - @jdevalk
11. ISS Munich - #iss #hreļ¬ang - @jdevalk
English site Dutch siteGerman site
hreflang=ādeā href=āhttp://example.com/de/ā
hreflang=āenā href=āhttp://example.com/en/ā
hreflang=ānlā href=āhttp://example.com/nl/ā
12. What would happen?
ā¢ Someone searching in Dutch would get the Dutch site.
ā¢ Someone searching in German would get the German site.
ā¢ Someone searching in English would get the English site.
ISS Munich - #iss #hreļ¬ang - @jdevalk
13. ISS Munich - #iss #hreļ¬ang - @jdevalk
German site
for Germany
German site
for Switzerland
German site
for Austria
href="http://www.example.com/de-de/" hreflang="de-de"
href="http://www.example.com/de-at/" hreflang="de-at"
href="http://www.example.com/de-ch/" hreflang="de-ch"
14. What would happen?
ā¢ Someone searching in German in Germany would get
the /de-de/ site.
ā¢ Someone searching in German in Austria would get
the /de-at/ site.
ā¢ Someone searching in German in Switzerland would
get the /de-ch/ site.
ISS Munich - #iss #hreļ¬ang - @jdevalk
16. But beware!
ā¢ In the previous example, which page would German
speaking / seeking people in Belgium get?āØ
ISS Munich - #iss #hreļ¬ang - @jdevalk
17. But beware!
ā¢ In the previous example, which page would German
speaking / seeking people in Belgium get?āØ
ā¢ A better solution:
ISS Munich - #iss #hreļ¬ang - @jdevalk
18. ISS Munich - #iss #hreļ¬ang - @jdevalk
German site
for Germany
& rest of world
German site
for Switzerland
German site
for Austria
href="http://www.example.com/de-de/" hreflang="de"
href="http://www.example.com/de-at/" hreflang="de-at"
href="http://www.example.com/de-ch/" hreflang="de-ch"
19. x-default
āThe new x-default hreflang attribute value
signals to our algorithms that this page doesnāt
target any specific language or locale and is the
default page when no other page is better
suited.ā
https://webmasters.googleblog.com/2013/04/x-default-hreflang-for-international-pages.html
ISS Munich - #iss #hreļ¬ang - @jdevalk
20. x-default
āThe x-default hreflang value signals
to our algorithms that such a page
doesnāt target a specific language or
locale.ā
https://webmasters.googleblog.com/2013/04/x-default-hreflang-for-international-pages.html
ISS Munich - #iss #hreļ¬ang - @jdevalk
22. ISS Munich - #iss #hreļ¬ang - @jdevalk
English site Dutch siteGerman site
hreflang=ādeā href=āhttp://example.com/de/ā
hreflang=āenā href=āhttp://example.com/en/ā
hreflang=ānlā href=āhttp://example.com/nl/ā
hreflang=āx-defaultā href=āhttp://example.com/ā
Country
selector page
24. What would happen?
ā¢ Someone searching in Dutch would get the Dutch site.
ISS Munich - #iss #hreļ¬ang - @jdevalk
25. What would happen?
ā¢ Someone searching in Dutch would get the Dutch site.
ā¢ Someone searching in German would get the German
site.
ISS Munich - #iss #hreļ¬ang - @jdevalk
26. What would happen?
ā¢ Someone searching in Dutch would get the Dutch site.
ā¢ Someone searching in German would get the German
site.
ā¢ Someone searching in English would get the English
site.
ISS Munich - #iss #hreļ¬ang - @jdevalk
27. What would happen?
ā¢ Someone searching in Dutch would get the Dutch site.
ā¢ Someone searching in German would get the German
site.
ā¢ Someone searching in English would get the English
site.
ā¢ Someone searching in Spanish would get the country /
language selector.
ISS Munich - #iss #hreļ¬ang - @jdevalk
28. ISS Munich - #iss #hreļ¬ang - @jdevalk
German site
for Germany
& rest of world
German site
for Switzerland
German site
for Austria
href="http://www.example.com/de-de/" hreflang="de"
href="http://www.example.com/de-at/" hreflang="de-at"
href="http://www.example.com/de-ch/" hreflang=āde-ch"
href="http://www.example.com/de-de/" hreflang=āx-default"
31. HTML meta tags
Easiest when youāre not in full control of everything:
<link rel="alternate" href="http://example.com/en-gb" hreflang="en-gb" />
<link rel="alternate" href="http://example.com/en-us" hreflang="en-us" />
<link rel="alternate" href="http://example.com/en-au" hreflang="en-au" />
ISS Munich - #iss #hreļ¬ang - @jdevalk
32. HTTP headers
Very useful for non HTML content:
Link: <http://es.example.com/document.pdf>; rel="alternate"; hreflang="es",
<http://en.example.com/document.pdf>; rel="alternate"; hreflang="en",
<http://de.example.com/document.pdf>; rel="alternate"; hreflang=āde"
Not always as easy to maintain for other stuff.
ISS Munich - #iss #hreļ¬ang - @jdevalk
40. Common issues
Yes. Common.āØ
This very scientifically āØ
correct pie chart from āØ
David Sottimano is sadly āØ
close to the truth:āØ
ISS Munich - #iss #hreļ¬ang - @jdevalk
Hreļ¬ang implementation
5%
95%
Screwed up
Got it right
42. 1. Broken links / relative URLs
ISS Munich - #iss #hreļ¬ang - @jdevalk
If your hreflang href links to:
43. 1. Broken links / relative URLs
ISS Munich - #iss #hreļ¬ang - @jdevalk
If your hreflang href links to:
ā¢ broken URLs
44. 1. Broken links / relative URLs
ISS Munich - #iss #hreļ¬ang - @jdevalk
If your hreflang href links to:
ā¢ broken URLs
ā¢ URLs that are redirected
45. 1. Broken links / relative URLs
ISS Munich - #iss #hreļ¬ang - @jdevalk
If your hreflang href links to:
ā¢ broken URLs
ā¢ URLs that are redirected
ā¢ relative URLs
46. 1. Broken links / relative URLs
ISS Munich - #iss #hreļ¬ang - @jdevalk
If your hreflang href links to:
ā¢ broken URLs
ā¢ URLs that are redirected
ā¢ relative URLs
47. 1. Broken links / relative URLs
ISS Munich - #iss #hreļ¬ang - @jdevalk
If your hreflang href links to:
ā¢ broken URLs
ā¢ URLs that are redirected
ā¢ relative URLs
It wonāt work.
49. 2. Missing return link
ISS Munich - #iss #hreļ¬ang - @jdevalk
If page A says A is English and B is German.
50. 2. Missing return link
ISS Munich - #iss #hreļ¬ang - @jdevalk
If page A says A is English and B is German.
Page B needs to say B is German and A is English.
51. 2. Missing return link
ISS Munich - #iss #hreļ¬ang - @jdevalk
If page A says A is English and B is German.
Page B needs to say B is German and A is English.
It can not lack the return link.
52. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
53. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
Language and Country / Region codes follow strict ISO
specs.
54. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
Language and Country / Region codes follow strict ISO
specs.
The first bit is the language, two letters, in ISO 639-1
format.
55. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
Language and Country / Region codes follow strict ISO
specs.
The first bit is the language, two letters, in ISO 639-1
format.
The second (optional) bit is the region. In ISO 3166-1
Alpha 2 format.
56. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
So Ferrari got it slightly wrong:
<link rel="alternate" hreflang="en-en" href="http://www.ferrari.com/en_en/" />
<link rel="alternate" hreflang="fr-fr" href="http://www.ferrari.com/fr_fr/" />
<link rel="alternate" hreflang="de-de" href="http://www.ferrari.com/de_de/" />
<link rel="alternate" hreflang="es-es" href="http://www.ferrari.com/es_es/" />
<link rel="alternate" hreflang="it-it" href="http://www.ferrari.com/it_it/" />
<link rel="alternate" hreflang="en-us" href="http://www.ferrari.com/en_us/" />
<link rel="alternate" hreflang="ja-jp" href="http://www.ferrari.com/ja_jp/" />
<link rel="alternate" hreflang="zh-cn" href="http://www.ferrari.com/zh_cn/" />
<link rel="alternate" hreflang="nl" href="http://www.ferrari.com/nl_nl/" />
This was on their nl page.
57. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
58. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
59. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
60. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
61. 3. Wrong country / region code
ISS Munich - #iss #hreļ¬ang - @jdevalk
This is btw quite a common issue:
<link href="http://www.independent.co.uk/"
rel="alternate" hreflang="en-uk" />
This should be en-gb of course!
64. 4. Canonical interference
ISS Munich - #iss #hreļ¬ang - @jdevalk
Each language should have a canonical that
points to itself.
65. 4. Canonical interference
ISS Munich - #iss #hreļ¬ang - @jdevalk
Each language should have a canonical that
points to itself.
If it doesnāt follow that simple rule, itāll
prevent hreflang from working.
66. 4. Canonical interference
ISS Munich - #iss #hreļ¬ang - @jdevalk
Each language should have a canonical that
points to itself.
If it doesnāt follow that simple rule, itāll
prevent hreflang from working.
So, in our earlier example:
67. ISS Munich - #iss #hreļ¬ang - @jdevalk
English site Dutch siteGerman site
<link rel=āalternateā hreflang=ādeā href=āhttp://example.com/de/ā>
<link rel=āalternateā hreflang=āenā href=āhttp://example.com/en/ā>
<link rel=āalternateā hreflang=ānlā href=āhttp://example.com/nl/ā>
<link rel=ācanonicalā href=āhttp://example.com/en/ā>
Correct implementation:
68. ISS Munich - #iss #hreļ¬ang - @jdevalk
English site Dutch siteGerman site
Correct implementation:
<link rel=āalternateā hreflang=ādeā href=āhttp://example.com/de/ā>
<link rel=āalternateā hreflang=āenā href=āhttp://example.com/en/ā>
<link rel=āalternateā hreflang=ānlā href=āhttp://example.com/nl/ā>
<link rel=ācanonicalā href=āhttp://example.com/de/ā>
69. ISS Munich - #iss #hreļ¬ang - @jdevalk
English site Dutch siteGerman site
Correct implementation:
<link rel=āalternateā hreflang=ādeā href=āhttp://example.com/de/ā>
<link rel=āalternateā hreflang=āenā href=āhttp://example.com/en/ā>
<link rel=āalternateā hreflang=ānlā href=āhttp://example.com/nl/ā>
<link rel=ācanonicalā href=āhttp://example.com/nl/ā>
70. 5. It looks ļ¬ne but it says itās broken!
ISS Munich - #iss #hreļ¬ang - @jdevalk
Maybe you have two implementations? If soā¦
Get rid of one!
83. Common reasons for breakage
Pages that are redirected, but the hreflang wasnāt
updated.
ISS Munich - #iss #hreļ¬ang - @jdevalk
84. Common reasons for breakage
Pages that are redirected, but the hreflang wasnāt
updated.
Pages that have been deleted in one language but
not in the other(s).
ISS Munich - #iss #hreļ¬ang - @jdevalk
85. Common reasons for breakage
Pages that are redirected, but the hreflang wasnāt
updated.
Pages that have been deleted in one language but
not in the other(s).
A developer thought āthis can be done so much
simplerā, and breaks it all.
ISS Munich - #iss #hreļ¬ang - @jdevalk
87. Regular audits
To prevent breakage, you need to audit
regularly.
ISS Munich - #iss #hreļ¬ang - @jdevalk
88. Regular audits
To prevent breakage, you need to audit
regularly.
If you have continuous integration, add
hreflang tests.
ISS Munich - #iss #hreļ¬ang - @jdevalk
91. Audit source code
Make sure the code that generates hreflang:
ISS Munich - #iss #hreļ¬ang - @jdevalk
92. Audit source code
Make sure the code that generates hreflang:
ā¢ has documentation that explains why;
ISS Munich - #iss #hreļ¬ang - @jdevalk
93. Audit source code
Make sure the code that generates hreflang:
ā¢ has documentation that explains why;
ā¢ points to documentation on the how;
ISS Munich - #iss #hreļ¬ang - @jdevalk
94. Audit source code
Make sure the code that generates hreflang:
ā¢ has documentation that explains why;
ā¢ points to documentation on the how;
ā¢ explains special cases like x-default;
ISS Munich - #iss #hreļ¬ang - @jdevalk
95. Audit source code
Make sure the code that generates hreflang:
ā¢ has documentation that explains why;
ā¢ points to documentation on the how;
ā¢ explains special cases like x-default;
ā¢ explains relationship to canonical.
ISS Munich - #iss #hreļ¬ang - @jdevalk
96. Regular audits
ISS Munich - #iss #hreļ¬ang - @jdevalk
Regular audits and smart code
documentation will keep your
hreflang happy!