Hreflang’s Basic Questions You Always Wanted to Ask
February 23, 2023Hreflang Rules & Guidelines
February 23, 2023Hreflang Methods of Implementation
You can use three methods to deploy HREFLang elements for your site. Google’s hreflang documentation states the three methods are equivalent to each other, and websites should implement the most convenient method for your websites.
This post presents an overview of each method and each technique’s pros and cons. Ultimately, your chosen method will significantly depend on your DevOps technical ability, the complexity of your website infrastructures, nuances to the specific guidelines, and how quickly you want to implement hreflang.
Whatever method you implement, the solution must ensure that it follows all of the rules of hreflang elements to be validated.
Hreflang Link Element (Meta Tags)
Commonly referred to as “Hreflang meta tags,” the hreflang link elements were the original method Google launched and required the site to put a specific set of hreflang HTML tags in the <head> section on each page listing the URL and all alternate variations in the hreflang cluster. A “hreflang cluster” refers to alternate URLs and their respective hreflang elements.
For this example, let us assume we have three websites. A US website and websites for the United Kingdom and Australia. This will require each to have three strings of hreflang tags on each page to represent the three alternate URLs in the cluster.
<link rel=”alternate” href=”https://mysite.com/” hreflang=”en-us” />
<link rel=”alternate” href=”https://mysite.com/en-gb/” hreflang=”en-gb” />
<link rel=”alternate” href=”https://mysite.com/en-au/” hreflang=”en-au” />
Pro | Con |
The hreflang element is embedded in each web page’s code and includes the entire cluster of alternate pages. | Requires a method to add tags to every page |
Some CMS can implement hreflang automatically | Requires each page to be indexed to validate the cross-tagging |
Easier to validate with SEO diagnostic tools | Multiple content management systems may not be able to implement across systems. |
Adds additional code to each page – 20 alternates = 21 lines or 1.5kb of extra code | |
Hard to remove URLs that are not valid |
HREFLang Header Statements
Hreflang elements placed in header statements were initially designed for non-HTML pages like PDF files that do not have HTML code so you can add the tags. Very few sites use this method as it is a bit more complicated to implement and is harder to check with diagnostic tools.
You must specify a set of <url>
, rel="alternate"
, and hreflang
values for every version of the page, including the requested version, separated by a comma, as shown in the following example. The Link:
header returned for every version of a page is identical.
Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en", <https://de-ch.example.com/file.pdf>; rel="alternate"; hreflang="de-ch",<https://de.example.com/file.pdf>; rel="alternate"; hreflang="de"
Pro | Con |
Can add hreflang elements to PDF files | Requires a method to add tags to every page |
Once implemented correctly no further action is required | Requires each page to be indexed to validate the cross-tagging |
If using multiple content management systems may not be able to implement on alternate systems. | |
Adds additional code to each page – 20 alternates = 21 lines or 1.5kb of extra code | |
Hard to remove URLs that are not valid |
Hreflang XML Sitemaps
Google released the XML sitemap option as an alternative to solve many of the complexities of adding tags to each page. The flexibility of XML sitemaps makes it one of the most scalable methods, which is why we developed Hreflang Builder.
Pro | Con |
It can be deployed quickly and easily updated over time | Requires a method to gather and match alternates |
Can use hreflang across different domains and CMS | Requires process to add sitemaps to server |
It does not require any on-site coding | |
It only requires the XML sitemap to be indexed to validate the cross-tagging of alternates. | |
Easier to ensure only valid URLs are in the output | |
Can include PDF URLs |
Multiple Methods Simultaneously
Google has repeatedly stated that using multiple methods simultaneously has no benefit or problem. The only challenge is when the settings are different. If you have multiple methods ensure they match in both language settings and market assignments. Google has