Skip to content
Nazmul Nikhil
Menu

Hreflang and HTML Lang Mismatch (Ahrefs): Make the Signals Agree

Ahrefs flags pages where the hreflang language and the HTML lang attribute disagree. Here's which one is wrong, how to tell, and how to fix it.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
Hreflang and HTML Lang Mismatch (Ahrefs): Make the Signals Agree
Photo: Saj Shafique on Unsplash

In short

Ahrefs flags "Hreflang and HTML lang mismatch" when the language a page declares for itself in hreflang is different from its HTML lang attribute, for example hreflang "de" but <html lang="en">. Google uses hreflang and the visible text, not the lang attribute, but browsers, screen readers and translation tools rely on lang. Check the page's actual language and correct whichever tag is wrong. It's usually the lang attribute, left at the site default.

A page can state its language in two places: the hreflang annotation and the lang attribute on the <html> tag. This issue appears when they disagree.

Which one is wrong?

Read the page. If it's in German, both should say German:

<html lang="de">
<link rel="alternate" hreflang="de" href="https://example.com/de/page/">
Pattern Likely cause
Every translated page has the default language in lang Theme hardcodes lang instead of using the current language
Only some pages mismatch Untranslated pages published in the wrong language folder
Region missing in one place (de vs de-AT) Not an error in itself; both describe German

How to fix it

WordPress: WPML, Polylang and TranslatePress set lang per language if the theme uses language_attributes() in header.php. If yours doesn't, fix the theme.

Shopify: the theme should use <html lang="{{ request.locale.iso_code }}"> in theme.liquid.

Webflow: Localization sets lang for each locale automatically. Check custom code that overrides it.

Wix: Wix Multilingual sets it per language. Check that each page is actually translated.

Custom builds: set lang from the same locale value you use to build hreflang.

This guide isn't affiliated with or endorsed by Ahrefs.

Sources and references

TAGSAhrefs Site AuditHreflang html lang mismatchHreflang vs lang attributeHtml lang wrong
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with International SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Site Audit Issues posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com