As you may know, hreflang lets search engines like Google and Yandex know that your webpage is available in a particular language and for a particular region. Meanwhile, the language or lang attributes on the HTML tag let your browser know the language of the current document or webpage.
To gain more insight on solving hreflang and HTML lang errors, consider watching the YouTube video below:
Read more on the Google Devs guide here on how to tell Google about the localized versions of your page.
What Does “Mismatch Hreflang and Lang Attributes” Mean?
As we stated above, this problem signifies that your hreflang and language HTML attributes don’t match or aren’t compatible with each other.
What Triggers This Issue?
When your language codes declared in the HTML lang attribute and in the hreflang annotation for the URL don’t match, you’ll see an issue report on the page. The issue may also get triggered when you have URLs where the hreflang annotations are defined, but they have a missing HTML language tag.
How to Check the Issue?
Check if you have an issue by running a code checker. If there is a problem, it will be shown in the reports on the page URLs for mismatched hreflang and HTML lang attributes. If no report about the mismatch of hreflang and lang attributes comes up, you’re safe from the problem.
However, this doesn’t mean that you’re free of other hreflang issues. If you encountered other types of hreflang errors, feel free to check our other guides.
Detect not only hreflang and HTML lang mismatch but also other kind of technical issue on your site!
Crawl your site and find out all kind of issues that can hart your users or your website SEO.
Why Is This Important?
Although Google doesn’t always necessarily use the HTML lang attribute today, other search engines and browsers do. Bing is an example of a search engine that still uses the HTML lang attribute. Some programs, such as screen readers, also need to understand the language of the page. They need both the hreflang and lang attributes to match to be able to deliver the page to your visitors.
This issue can also affect your SEO and how visitors find you on the affected search engines.
How to Fix the Issue?
To solve this issue, review the pages that got listed in the report. Ensure your pages have the language (or language and country) code declared in the HTML lang attribute. For example, a page for visitors from the United Kingdom should have the language (English, UK) declared for it. The same should apply to other countries and languages.
Also, keep in mind that the language code must conform to ISO 639-1 format for the code to work. Otherwise, the code would come out with an invalid tag and wouldn’t work on certain browsers, search engines, or programs.