How to add, test and validate Hreflang Tags: An Hreflang Implementation Guide for Success

Aleyda Solis walks through hreflang implementation for international SEO: how to spot when you need it using Google Search Console and analytics, the three ways to add it (HTML tags, XML sitemaps, HTTP headers), correct ISO codes, and free tools to validate it. Common mistakes include wrong codes, missing alternates, and canonical mismatches.
Chapters
Crawling Mondays! In today's episode of Crawling Mondays, which is actually the 10th episode, I want to do something special and to help you solve one of the biggest mysteries of our times. And I am not talking about sort it out if we're living in a simulation. If not, unfortunately, I'm not that smart. However, I do want to help you clarify and sort out, uh, um, when you need to implement hreflang annotations, how you can use and implement hreflang annotations for success. And, and realistically, this is a topic that I have covered, um, well in the past as an international SEO. I have And I will refer to a few resources I already have about the topic that you can easily get and obtain online already. However, I have to say that this is a topic that again and again I am asked about. The other day I was seeing a tweet of someone saying like, it was so painful to go through a short language implementation. I didn't see and I didn't perceive any positive outcome. And realistically, Somehow, because we are going to see that it shouldn't be like that, but hreflang annotations is perceived to be one of the most complex aspects of SEO. But anyway, don't worry, I got your back and in today's episode I will clarify and take you through the main criteria that you should use to simplify as much as possible the process and to make it much more cost-efficient and ROI-positive. Let's take a look. So why hreflang annotations are important? What do they do in the SEO process, right? And it is important to clarify something. Google doesn't rely only on hreflang annotations to identify a page locale. Google even, they have listed, if you see here in this Search Console help article, which is very, very, very good to understanding how they manage international-oriented, multinational-oriented, multilingual pages, right, how they process these pages. And in one area you will see a list of signals that they actually use to identify the best target audience for a page, right? So hreflang annotations is one of those signals. It's not the only one. Of course, we want to make sure to provide Google as many signals as possible and that all of these signals are as aligned as possible too. It's very, very handy because it's actually one of those methods that we can specify at a page level and we can go as granular as possible and we can directly control them, right? There are other methods and there are other ways for Google to identify locale and we can see how they can identify it based on if we use a country code top-level domain name, ccTLDs, to target specific countries. How if we don't use ccTLDs and we are using subdirectories or subdomains and we need to geolocalize them through the Google Search Console. Now that I have clarified that, again, it's not the only way, it's not that if we don't implement hreflang annotations the SEO, international SEO process won't be successful, let's move on with So when do we actually use hreflang annotation? When it does actually make much more sense due to resources constraints. The best way to identify which of our international versions actually need hreflang annotations is by prioritizing their implementation of those that are actually misaligned. Those pages that are targeted towards a specific language specific country and despite of that are ranking and getting organic traffic from another country, or if they are in a specific language and they are attracting rankings and traffic from another language, right? And you can easily identify this in a very straightforward way already with your own existing data in the Google Analytics or Google Search Console also to actually see the query that is that is triggering this visit from a non-relevant location, right? So by going to the performance report here, you can go to the countries tab and let's say that this is a .net domain. Let's imagine if this was a .fr domain targeted towards France. You want to see here as a country only France. However, you may see that you also have traffic coming from Canada. Maybe people searching in French from Canada end up seeing pages from this site version instead of the proper Canadian French version that they should get. So these are the type of scenarios where you want to prioritize hreflang annotation implementation and you can already get it here. By going through the Google Search Console performance report. But of course you need to, you see, and this is my problem a little bit with the challenge that I have with the report, the performance report here that you need to go through and click and filter a lot in order to obtain the data of which are the queries that trigger this result from these countries and which are the pages obtaining that visibility that they shouldn't have. But you can do the same actually to expand and complement this data with third-party tools, with Semrush or with Ahrefs for example, or even Sistrix, right? I really like the way that Ahrefs displays this because you can go to any of your international web versions, so for example here I am in the Spanish version, Spanish for Spain version of Apple, and they are using subdirectories to target internationally, so I imagine that they they, they have geolocated this es/es subdirectory to Spain. And however, and we can see that indeed like 95% of their, their, their organic traffic based on, on Ahrefs data is coming from Spain, so that is good. However, there is like a little bit more than 1% that is coming from Argentina. I really want to see if, if the traffic that is coming from Argentina to the Spain version is coming here because there is a misalignment issue, is because this page doesn't exist actually in Argentina. So when they search for this product, they are shown the Spain version because there's nothing for Argentina. But if there is something for Argentina that should be shown for Argentinian users, So this is the type of scenario that we want to specify Ahrefs for. So for example here, we can see Argentina and we can take a look which are the top keywords providing traffic in this case to Apple Spain but from that country, but from Argentina and the queries, top queries here. So we can see that one of these is iPhone 8 Plus, right? And we can see how the shop for the iPhone 8 Plus is getting the first position and it has this search volume from Argentina, it's providing this type of traffic, right? It's non-trivial. Again, if this page doesn't exist in Argentina for the Argentinian users, so it is reasonable that Google ends up ranking this version of the page because it's in Spanish and there's nothing better to show them. However, if this page also exists in the Argentinian version of Apple, so that should be the page that should be shown to Argentina users. And these are the type of those scenarios where we want to take these pages and prioritize the hreflang annotations in these cases. So how do we implement hreflang annotations? The 3 methods, let's start with potentially the simplest one, which is by including these tags in the HTML head. These are tags that they follow this pattern, right? Like the link rel alternate hreflang, and here we should include the language and alternatively the country if we are also country targeting and not just language targeting web many different versions for different languages. When we specify a country, we should always specify a language along with the country. However, if we are only language targeting, we can very well only specify a language, right? Spanish, English, German, etc. But if we want to specify that there's a version for Spain, a version for Mexico, a version for the US, then we need to include the language of that version along the country. So for example, in this particular case, you can see how I have actually 3 pages, right? brand.com in English for the US, brand.com/es in Spanish for the US, and then brand.co.uk in English for the UK. And then for each one of these, I want to specify with hreflang annotations where they are targeted towards each country and in which language they are and which are the other versions that exist for this same page. So for the homepage again here in English for the US, I include the language, the en, and the value for the US case and then the URL, this particular URL. The homepage for the US. And then I also specify which is the Spanish version for the US and which is the English version but for the UK. And I include the URLs here. And I need to do the same with the Spanish version for the US and the English version for the UK. Again, I need to include the same tags in these other pages too. So this is the reason why it gets so complex so easily because we need to specify hreflang annotations by page, page by page, and not only saying or declaring, specifying towards which language and alternatively also country each page is targeting, but all the other variances that exist for this particular page that I also want to specify to avoid the misalignment issue. And the codes that are supposed— supported by Google are the ones of the ISO 639-1 for the languages, and for region is the ISO 31661-2, right? And we have the list of these values. Actually, if we go and we click on any of these pages in the Wikipedia here, specifying the one for each one of the languages, And the same with country. It's important to validate which are the values for the languages that we want to specify and the countries that we want to specify to make sure that we are using the specific values that are actually supported by Google and then that we are also using them in the tags in a way that are supported by Google because a lot of people use, for example, instead of dashes, they use underscore or they put the values together, the language and the country values, and Google doesn't support that. They need to be separated here by a dash. So it should be language and then country separated by a dash. So we can see that one of the methods to implement hreflang annotations is by including these tags in the head area of every page. This is the best when you have flexibility to do it so and you don't have so many different international versions, languages, and countries to specify because you can end up having a huge list of codes here, of extra code in your HTML, which you should definitely rather avoid. But there are other ways to do it. To do it whenever you don't have the flexibility to add or change the code in the head of your HTML or when there are so many different international versions that it will be too much to add them, which is actually with the XML sitemap. This is the other preferred way, the other alternate way and the way that I will suggest to do it when you have too many international versions to specify, when you cannot added directly to the HTML, the head area of the HTML of your pages. So you can generate here, as you can see, in a very similar way as with hreflang annotations for the HTML, you can generate a sitemap that for each page here that you specify, you include this link tag specifying again rel alternate hreflang value of the language along the country in case you have a country for the page and the URL. And we have 3 pages. We have the English one that is specified here along the 2 different alternates, the German one in general and the Swiss German for Switzerland here. And so I need to also specify the German, I need to also specify the Swiss German and specify them as well in the same way, in a similar way saying I am This, and this is my language and country targeting, and these are my alternate pages. So again, you can easily generate and end up generating a very big XML sitemap like this, but at least in this case, you don't need to touch and you don't need to modify your HTML. And there is a third method, which is with HTTP headers, that I will say it might be the way to do it for documents that are not HTML. If you need to specify the hreflang annotations for PDFs, for example, as here in the example. Another very important aspect to take into consideration when implementing hreflang annotations is that as of today, there's no official support for regions or continent values. You can see it here, like, Google has confirmed many times that they only officially support whether language or country values in hreflang annotations. In fact, there's no way to geolocate also through the Google Search Console for regions in general. They don't support regions or continent. And the same happens with hreflang annotations for having an en-EU. They won't officially support this value, right? So it's important to align and validate, check very well first which are the actual supported values that we get through the ISO list that they publish and implement it across all different versions accordingly. Something important though, and again I get these questions many times regarding what do we do with the canonical tag, how do we canonicalize these pages? That we are tagging with hreflang, right? Realistically, each one of these pages are their own original versions towards their own audiences, right? So they should be self-canonicalized towards each one of them in particular, right? So here the English for the US should be self-canonicalizing towards it, the same with the Spanish version for the US, the same for the English version for the UK. This should be a canonical tag pointing, self-referring to each one of them in each particular case. I created this free tool a time ago in order to help, to easily help to generate edge-of-line annotations. So you can see it's very straightforward to use like this, so you can easily generate your tags like this. So you will need to include here, for example, the URLs of some of those pages that you actually want to tag. And you here choose if you want to include them in the head area of the HTML to obtain those tags or generate this hreflang through XML sitemaps. So if I generate the XML sitemap, I will obtain this. So you can see the values here, the country and the languages, the ones supported, and the URLs that I have specified. Specified above. And this is actually supported and specified as Google documents in their own specification. So it should be very straightforward for you to generate these patterns that you can use along your development team for all of the pages that will require them in your website by just updating the URLs for the relevant one. And to identify if you have particular hreflang annotation errors in some of your pages, you can use free tools like the one of the hreflang checker that is completely free and the one of the technicalseo.com website too. They are completely free and they will allow you to identify if there are any errors and specify the type of errors. It's very, very good, right? So for example, if I enter here my website and submit here for a quick hreflang audit, it will tell me if it finds any inconsistency across the hreflang annotation specification of my homepage in this particular case. But if, of course, if you want to validate and troubleshoot all of the implementation of hreflang annotations across your website. Most SEO crawlers nowadays support this validation. So for example, this is the view of Sitebulb that I really like a lot, how they specify and show the hreflang annotations for each one of the site versions here and how they list potential issues and problems with hreflang annotations. Besides the wrong values or the wrong syntax of the tag, it is also very usual to see errors coming because of pages that are not the original versions of the URLs that are not the original versions, the indexable version of the pages sometimes because hreflang annotations are generated through SMSs or plugins, etc. Sometimes the— or in bulk, right? Sometimes the URL that is specified to be the version for Spanish for Spain is actually not the actual indexable one, but it's redirecting to another one, or it's showing a 404 HTTP error, or it's canonicalized to another URL, et cetera. This tends to happen, and if it happens, you will see that there is an error trigger. That you need to fix. DeepCrawl here, I showed Sybil before, you can see that DeepCrawl also includes and validates hreflang annotations. It's great because it tells us where it has found the hreflang tags, if it has been in the code, if it has been in a particular XML sitemap. So this really makes it easier for you to troubleshoot and go through hreflang annotations Because at the end, unfortunately, you will see that sometimes when we publish, we have certain numbers of errors, right? And we go and check, it's because some particular pages are not pointing back, are not referring back to one of the alternate versions. And so we need to end up doing a little bit of troubleshooting usually after releasing and publishing hreflang annotations like this. So it should be about prioritizing those language and country versions with most of the errors showing and making sure to prioritize them through the troubleshooting process, identifying why they are triggering this error. It is because they are canonicalized to other URLs, it's because they are, these pages don't exist in this version and so on. And eliminate and prune accordingly to obtain at some point this. This is the goal that we look to achieve, right? To have international versions that don't trigger any hreflang errors, whatever the cause, that they are correctly identified in every case. So we achieve the actual result, a positive ROI of all this implementation, that is that the actual page is shown in the relevant country for the relevant language for the desired audience. So this is why I actually, and I will recommend you to do the same, take a look at this 6-step implementation process that I shared for HFL implementation a while ago. So I hope that this video has given a little bit of more light to the HFL implementation process that I know can be very resource-intensive indeed. And like this, you'll be able to prioritize the steps or the effort that is that is needed and you can manage in a much more reasonable way your expectations also, what you're looking to achieve with it. And if at some point, if you verify and validate that you don't have misalignment issues at this moment, then there's no point to implement hreflang annotations then because it seems that Google is already identifying pretty well your international targeting and surprise, you don't need to prioritize this in the time being because it will be a good A good nice to have, but not a required type of implementation or a must have type of implementations to fix something that is actually wrong. So thank you very much for joining me in today's Friday Mondays and looking forward to see you in the next one. Bye bye. Friday Mondays.
More from Aleyda

How to Communicate and Sell AI Search Optimization (GEO, AEO, LLMO) to Decision Makers

AI Search Optimization (GEO, AEO): What is it, Common Errors & How to Optimize AI for Success

OpenAI has introduced shopping research in ChatGPT - #SEOFOMO TL;DR December 1st, 2025

OpenAI announces Instant Checkout and the Agentic Commerce Protocol - #SEOFOMO TL;DR Oct 6, 2025

Google's August 2025 Spam Update Finished Rolling Out - #SEOFOMO TL;DR September 29, 2025





