In the set of hreflang tags, each language code should point to one address only, and wherever the set is declared, every place should say the same. The safest way is to let a single system write the hreflang tags, in a single place. Search engines can only use the set if it is unambiguous.

hreflang tags can be declared in three places: in the HTML of the page, in the HTTP header of the server's answer and in the XML sitemap. For Google the three are equivalent, and combining them brings no benefit. This guide covers the two findings that appear when these statements contradict each other. Usually two systems are then writing hreflang tags at the same time without knowing about each other.

One language code points to several pages

Finding in the report: HREFLANG_DUPLICATE_LOCALE

What it means

In one place, for example in the HTML of a page, the same language code appears twice in the hreflang tags, with different addresses. The search engine cannot tell which of the two pages is the version for that language.

The finding in the scan report names the language code, the place where it was declared (HTML, HTTP header or sitemap) and the addresses it points to.

Typical causes

  • Two systems write hreflang tags into the same page, for example the translation plugin and the theme, or two plugins.
  • Two pages are connected as translations for the same language, for example an old and a new version of a page.
  • A hand-written list of hreflang tags contains an outdated address next to the current one.

How to check

  1. Open the page named in the finding and look at the place the finding names: the page source for HTML, the server's response headers for the HTTP header, or the source code of the sitemap.
  2. Find the hreflang tags with the language code from the finding and compare their addresses.
  3. Find out which system writes each tag: the translation plugin, the SEO plugin, the theme or your own code.

How to fix

  1. Decide which page is the right one for this language code.
  2. Keep only that address in the set of hreflang tags. If two systems write hreflang tags, switch them off in one of them.
  3. If both pages are needed, for example for two regions, give each its own language code with a region, such as de-DE and de-AT.
Ambiguous, and how it should look
<!-- ambiguous: two addresses for "de" -->
<link rel="alternate" hreflang="de" href="https://example.com/de/shop/">
<link rel="alternate" hreflang="de" href="https://example.com/de/shop-old/">

<!-- unambiguous: one address per language code -->
<link rel="alternate" hreflang="de" href="https://example.com/de/shop/">

How to confirm the fix

  • Check the place named in the finding again: the language code should appear only once in the hreflang tags.
  • Scan again: the finding disappears from the report once each language code points to a single address.

HTML, HTTP header and sitemap say different things

Finding in the report: HREFLANG_CONFLICTING_SOURCES

What it means

The hreflang tags are declared in more than one place, and the places name different addresses for the same language code. For example, the HTML names one page as the German version and the sitemap another.

Google treats the three places as equivalent and gains nothing from combining them. If they disagree, it is unclear which statement counts.

The finding in the scan report names the language code and the addresses declared in each place.

Typical causes

  • The hreflang tags in the HTML are current, but the sitemap is outdated, for example because another plugin generates it or because it is cached.
  • The translation plugin writes hreflang tags into the HTML, and an SEO plugin writes its own into the sitemap.
  • A rule on the server or in a CDN adds hreflang tags to the HTTP header that nobody remembers.

How to check

  1. Look up the addresses for the language code from the finding in each place it lists.
  2. Find out which system writes each place, and which addresses are the current ones.

How to fix

  1. Decide on one place for the hreflang tags and switch off the others, or make sure all places are generated from the same data.
  2. If the sitemap is outdated, have it generated again and clear the caches.

How to confirm the fix

  • Compare the places again: they should name the same addresses.
  • Scan again: the finding disappears from the report once all places agree.

Setup in WordPress, Shopify & co.

WordPress + WPML

According to the WPML documentation, WPML SEO puts the hreflang tags into the XML sitemap as soon as the sitemap of Yoast SEO or Rank Math is switched on (since WPML SEO 2.2.0, June 2025). On its first run it switches off the tags in the page's <head>, so that search engines do not get them twice.

Both places carry hreflang tags only in two cases: if the sitemap was switched on later, because WPML then leaves the <head> tags on until you switch them off yourself, or if the <head> tags were switched on again. If the two disagree, the scan reports contradictory sources. Keep the tags in one place; the guide on setting up hreflang names the settings.

To compare, open the source code of the sitemap: the readable view that the browser shows hides the hreflang tags. Contradictions also appear when another plugin or the theme writes hreflang tags as well. Keep only one system.

More on this: WPML: why your hreflang tags are no longer in the page source

Sources: WPML: URLs, slugs and SEO (external link) · WPML: Yoast SEO Multilingual (external link) · WPML SEO 2.2.0 (external link)

Shopify

Shopify writes hreflang tags automatically. If a theme or an app writes its own as well, Shopify advises switching off the automatic tags under Online Store → Preferences; otherwise there are duplicates. To switch them on again, first remove all custom hreflang tags from the theme.

Sources: Shopify Help: SEO for international markets (external link)

A website with its own code, or a simple site without a database

Declare the hreflang tags in one place only. If you need a second one, for example the HTTP header for files that are not HTML, such as PDFs, generate both from the same list of language versions.

If your sitemap is a static file, update it whenever pages are added, removed or renamed, or generate it automatically.

Further reading