Skip to main content
All CollectionsSite AuditIssues
"Hreflang annotation invalid" error in Site Audit
"Hreflang annotation invalid" error in Site Audit

Learn more about the "Hreflang annotation invalid" issue in Ahrefs' Site Audit and how to fix it on your website.

Anna avatar
Written by Anna
Updated over 5 years ago

What triggers this issue?

This issue reports page URLs where the language (or language-location) code declared in the hreflang annotation is invalid. Language code must adhere to ISO 639-1 format, region code must be specified in ISO 3166-1 Alpha 2 format.

Example in page header:

<head>
...
<link rel="alternate" hreflang="en-uk" href="https://ahrefs.com/blog/google-keyword-planner/"  />
...
</head>

Example in HTTP header:

Link: <https://ahrefs.com/blog/google-keyword-planner/>; rel="alternate"; hreflang="en-uk"

en-uk is not a valid language-region code for the United Kingdom. It must be en-gb instead.

Why is it important?

Google, as well as other search engines, will ignore hreflang annotations with invalid language (or language-region) codes. Consequently, search engines may "overlook" alternate versions of your page and will not be able to point users to the most appropriate version of your page by language or region.

How to fix it?

For each reported URL, look at the columns shown in the screenshot below:

Look for "No" in the "Is valid hreflang" column to find invalid values in hreflang annotations.

"bel" in the example above is not a valid language code for Belarusian and must be replaced with "be."

If you need a list of URLs that have a given invalid language or language-region code, you can easily do it with one additional filter.

Make necessary edits to the hreflang annotations on all reported pages.

Multiple language/locale versions of a page can be specified in:

1. HTML tags

Example:

<link rel="alternate" hreflang="ru-ru" href="https://ahrefs.com/blog/ru/" />
<link rel="alternate" hreflang="es-ar" href="https://ahrefs.com/blog/es/" />
...

2. HTTP Headers Link

Link: <https://ahrefs.com/blog/ru/>; rel="alternate"; hreflang="ru-ru",  <https://ahrefs.com/blog/es/>; rel="alternate"; hreflang="es-ar", ...
Did this answer your question?