Technical SEO (#2): How to implement hreflang tags correctly on a multilingual website?
Hey lazy website owners! 🛋️ Want to make sure your multilingual website speaks the language of search engines? It’s as easy as slapping on some hreflang tags! Let me show you how it’s done.
First things first, let’s break down what hreflang tags actually are. Think of them as little flags that tell search engines which version of your website to show to users based on their language or location. Pretty neat, huh?
Now, let’s get down to business. Take a look at this simple example using my buddy Oleh Dankevych’s website:
<link rel="alternate" href="https://olehdankevych.com/" hreflang="x-default" />
<link rel="alternate" href="https://olehdankevych.com/" hreflang="en" />
<link rel="alternate" href="https://olehdankevych.com/it/" hreflang="it" />
See what we did there? We’ve told those search engine bots that Oleh’s website is available in English and Italian. So, no matter where your users are from, they’ll get the version of the site that speaks their language.
But wait, there’s more! Hreflang tags aren’t just about languages—they can also target specific regions. So if you’ve got different content for users:
<link rel="alternate" href="https://olehdankevych.com/" hreflang="x-default" />
<link rel="alternate" href="https://olehdankevych.com/" hreflang="en" />
<link rel="alternate" href="https://olehdankevych.com/uk/" hreflang="en-GB" />
<link rel="alternate" href="https://olehdankevych.com/us/" hreflang="en-US" />
<link rel="alternate" href="https://olehdankevych.com/it/" hreflang="it" />
<link rel="alternate" href="https://olehdankevych.com/ca/" hreflang="en-CA" />
Now, I know what you’re thinking: “But Oleh, this sounds like a lot of work!” Fear not, my lazy friends, because once you’ve set up those hreflang tags, you can pretty much forget about them. Just let those search engines do their thing while you kick back and relax.
So there you have it, folks! With just a few simple lines of code, you can ensure that your multilingual website is speaking the language of SEO loud and clear. Happy optimizing!