The fix, in one snippet
<html lang="en-gb">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/">
Illustrative values. Change the paths, hostnames and options to match your own site before using it.
The sections below explain what is tested, why it matters and the alternatives.
What we test
We collect the lang attribute from every crawled page, reduce each to its primary subtag, and compare. The check fails when more than one language is declared across the crawl and no page carries hreflang annotations linking the versions together.
A single declared language passes. Several declared languages pass too, as long as hreflang connects them, because that is exactly what a correctly built multilingual site looks like.
Why it matters
A multilingual site without hreflang is a set of pages that look like duplicates in different words. Search engines work out the language from the content and usually get it right, but they have nothing to tell them that the French page is the French version of this page rather than a separate document.
The symptom is a visitor in France landing on the English page, or the two versions competing for the same query and neither ranking as well as one would. It is also the harder case to diagnose later, because nothing is broken: both pages are indexed, both are fine, and the traffic simply goes to the wrong one.
The other cause of a mixed result is accidental: a template hardcoding lang="en" on pages that were translated, which tells the engine the opposite of the truth.
How to fix it
Set the language from the same variable that selects the translation, so the two cannot disagree, and connect the set with hreflang on every member:
<html lang="fr">
<link rel="alternate" hreflang="en" href="https://example.com/">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">
Every page in the cluster needs the complete list including itself, and each annotation has to be reciprocated or it is ignored. For a large site the same annotations can go in the XML sitemap, which is easier to keep symmetrical than per-page markup.
Where this fits
Language declarations disagree is check 1 of 3 that the seo & site health audit runs under international targeting, ordered the way they are worth fixing. That ordering is the point: Fixing this one while the check above it still fails buys less than it looks like.
What fixing this still leaves open
Language declarations disagree closes one route in. Immediately below it: hreflang annotations invalid, where hreflang tells search engines which language and region each version of a page is for; hreflang return links missing, where hreflang must be reciprocated.
Found in the same scan
The seo & site health audit reports this alongside checks from other categories that are at least as serious, including Broken internal links, where an internal link that returns an error is a dead end for the reader and a wasted request for the crawler, and Crawl errors (4xx / 5xx), where uRLs reached during the crawl that returned a client or server error. A single run of seo & site health audit answers all of them at once.
The first few lines
You are a senior web engineer. I ran a security and SEO scanner against my site and it reported the finding below. Fix it properly rather than suppressing the symptom.
Finding: Language declarations disagree (medium severity)
Scanner check id: seo-language-consistency
The rest of this prompt names the pages and line numbers we found the problem on, the configuration to change, and the constraints a good answer has to respect. It is free, it just needs an account so the work is not scraped wholesale.
Sign in with GoogleSigning in is free and takes one click. We store your email address and nothing else.