Prior to implementation, it’s important to understand what type of hreflang implemention is required, whether it be based on language, location or a combination.
I won’t be going into the nitty gritty aspects around implementation, though it is worth noting that there are three different methods of hreflang implementation:
- HTML <head>
- XML Sitemap
- HTTP header
Likely the most common form of implementation, the hreflang tags simply sit within the <head> of a page, and is generally the preferred option for developers as it typically takes the least time.
Note: Despite it being a requirement from Google, I have seen hreflang tags working whilst sitting within the <body> of the page code.
Instead of having code on each page, one can opt for the XML sitemap method. This has multiple benefits including:
- Listing all relevant hreflang tags in a single consolidated file
- Ability to reference and set hreflang tags on non-html files (e.g. PDFs)
- Slight reduction of page code (see page speed)
More relevant to non-HTML sites, this method requires configuration at a server level. This method is likely the most time consuming and difficult to manage ongoing.
There are pros and cons of each option, but from my experience the best implementation method is the one that works for your business, both from a technological and upkeep perspective, as hreflang is rarely a onetime fix – ongoing love is a requirement.