Skip to content

This translation has not been editorially reviewed yet. The German version is authoritative. Deutsche Fassung →

Indexing

Why must a page's language attributes agree?

Because a website declares its language in two places — in the source code (the html element's lang attribute) and in the server response (the Content-Language header) — and contradictory values make every decision built on them unreliable: search's country matching, the language choice of translation and screen-reading features, and categorisation by answer engines. Our check compares both values and reports contradictions.

Two places, one truth

The lang attribute is set by the content team or the template; the Content-Language header is set by the server or hosting. Because different parties are responsible, the two values drift apart: the source code says "de", the server says "en", because it's set to an English default. Invisible to visitors, a contradiction to machines — and depending on the service, sometimes one value wins, sometimes the other. An Austrian website does best with "de-AT" in both places: language AND region, consistently.

What the check exactly measures

The check reads the lang attribute from the source code and the Content-Language header from the server response, and compares the two. The report states both measured values — so it's immediately clear which side of the configuration needs fixing. The finding is classed as mild, but easy to resolve: a server setting or a line in the template.

  • Decide on the authoritative value — de-AT for an Austrian website — and set it in both places.
  • Check the Content-Language header after hosting moves: it's the place that most often silently changes.
  • For multilingual websites, mark up every language version with its own internally consistent value.

FAQ

What's the difference between "de" and "de-AT"?

"de" only names the language, "de-AT" also names the Austrian region. The longer form helps anywhere regional distinctions are made — matching to Austrian search, for instance. More important than the format is that both places agree with no contradiction.

Which of the two values matters more?

The lang attribute in the source code is read by most services, including screen readers — it takes priority for maintenance purposes. The server header should confirm it rather than contradict it; otherwise the outcome depends on which value a given service happens to read.

Does the finding also affect accessibility?

The language attribute itself, yes — it controls screen reader pronunciation and is its own check criterion there (WCAG 3.1.1). This indexing finding checks the CONTRADICTION between the source code and the server response; it complements the accessibility check rather than replacing it.

Deutsche Fassung dieser Seite