Implementing hreflang for a programmatic build isn’t necessarily hard, once you understand what content you have.
If a piece of content is available in multiple languages and/or target markets, throw up a tag for that version.
If the piece of content isn’t available, don’t have a tag.
There seem to always be bugs in implementations though, mostly silly little things that are easily patched.
Is hreflang important for programmatic builds?
If you’re an international website, in either multiple markets or multiple languages, then yes, hreflang is extremely important for your programmatic build.
Google isn’t as smart as you think, and requires a lot of direction, or, ‘hints’ at they call them.
Whilst it will do its best to understand the relationship between two pieces of content across your site, telling them bluntly and clearly that these two-piece relate via either being different languages or targeting different markets for the same piece of content.
Pre-launching into a market with programmatic SEO
You could be a classified site, portal, or marketplace looking to expand your reach into new markets.
You can deploy a programmatic build, and start to gain a foothold in a new market before actually pushing the brand there.
Start to rank and drive traffic in a fresh country, and test the waters, without spending $ on any local advertising.
Essentially known as a ‘dark launch’, you can start to build rankings & value in a market, well before you actively want to push there.
The pages will get indexed, and you can start to push your content out in the market, and even acquire new content/listings slowly.
Tips for an hreflang implementation
Some of my top tips for an hreflang implementation are;
- Ensure the current page is included in the tags
- Ensure x-default is implemented correctly
- Don’t allow content that doesn’t exist in flagged language, to exist
- Ideally implement meta tags or XML sitemap, not both
- Ensure each page in the hreflang correctly references all other pages
Hreflang meta tags vs hreflang XML sitemap
I personally try to stick with hreflang meta tags in the <head>, as it’s easier to check, which makes my life easier.
When sites start to get to 50+ available languages/locations, then things change though.
Aleyda Solis pretty much sums it up in this tweet.
For small sites/small number of versions: HTML head
For big sites/high number of versions: XML Sitemap
— Aleyda Solis 🇺🇦 (@aleyda) July 1, 2022
So small sites get a meta tag. Big sites, get the XML sitemap.
It’s recommended you don’t use both though, as you can run into validation/update issues depending on which version was last cached.
Hreflang testing tools
Testing via generation
Whilst not a ‘testing’ tool, you can test the output of your build by generating hreflang tags on Aleydas site here. Check to see if the output of the tool, is the same output as what is expected.
Favourite direct testing tool
My favourite testing tool for validating an hreflang implementation is this one.
You throw in your URL, along with selecting a user agent, and you’ll get a nice little report back of all the URLs included in the hreflang. The tool will then quickly scan them all, to determine the tag’s validity and whether return references are available.
The top issues with hreflang tag implementations
No self-referencing hreflang
Sometimes the canonical is believed to be the required self-referencing tag. Whilst it is required, it is separate from the hreflang setup.
You must include an hreflang tag for the current page, just as it would be referenced on any other page.
Basically, every page gets the exact same set of hreflang tags.
Incorrect language/region content being shown
A page should not have any content other than its flagged content. Well, excluding any terms/legal callouts that are required that is.
If a language is flagged as German, then it should only include German content.
If a page is flagged as English, it should only include English content. No mixing and matching.
You should hide any content that isn’t in the flagged language.
Incorrectly flagging a URL that doesn’t exist
Sometimes, content is mismatched between languages & regions, and that is perfectly mine.
But don’t tell Google that the content is available in other languages & regions if it’s not.
Don’t include hreflang references to pages that don’t exist in the flagged language. These pages should instead be removed from the hreflang, and should not have hreflang tags on the page itself.
So for a blog post, if that post is only available in its current language, don’t have hreflang tags (you could have a tag to itself, and only itself, if that simplified implementation though).
If a page is available in 3/4 languages, then only mark up for those 3/4 languages, and have the 4th as a 404.
Make your hreflang simple where possible
Try and keep it simple, and as your build grows, it will be easier to maintain