Skip to Content
OpportunitiesTechnicalIssue ReferenceHreflangSame hreflang value used more than once

Same hreflang value used more than once

What it is

Two or more hreflang links on the page use the same value, such as two en-GB entries. When they point to different URLs, the page names two pages for one audience. When they point to the same URL, one is redundant. Either way it usually means two systems write hreflang links, or a template adds the current language a second time.

Why it matters

Hreflang describes a set in which each language version is listed  alongside all the others. With two URLs under one value, Google does not document which it uses, so the page shown to that audience is no longer your choice and may differ from page to page. A repeated identical entry has no documented cost, but it shows that the tags are generated in two places, and the next change to one of them can make them disagree.

How Asky checks it

Asky reads the value of every <link rel="alternate" hreflang> in the page’s raw HTML, trims it and lowercases it, and reports the page when any value appears more than once, x-default included. en-GB and en-gb are the same value; en and en-GB are different. The href is not compared: two links with one value are reported whether they point to the same URL or to different ones, while different values pointing to one URL are allowed. Hreflang in an HTTP Link header or an XML sitemap is not read, and links added by JavaScript are not seen.

Reported as an error with high severity.

How to fix it

  1. Open the page source, search for hreflang and note which value repeats and where each copy points.
  2. Keep one link per value, pointing to the page meant for that audience.
  3. If two different pages both serve that audience, choose one for the value. Give the other a different value, such as a specific country, or leave it out of the set.
  4. If two systems write the links, such as a multilingual plugin and head custom code, or a CMS localization feature and an SEO plugin, switch one of them off.
  5. To aim one page at several countries, give it one link per value (en-GB, en-IE); different values pointing to one URL are fine.
  6. Make the same change on every page in the group, so each version lists the same set, with a single x-default.

Example

https://example.com/pricing lists en-GB twice, for two different pages:

<!-- Before --> <link rel="alternate" href="https://example.com/uk/pricing" hreflang="en-GB"> <link rel="alternate" href="https://example.com/pricing" hreflang="en-gb"> <link rel="alternate" href="https://example.com/pricing" hreflang="x-default"> <!-- After --> <link rel="alternate" href="https://example.com/uk/pricing" hreflang="en-GB"> <link rel="alternate" href="https://example.com/pricing" hreflang="en"> <link rel="alternate" href="https://example.com/pricing" hreflang="x-default">

← Back to Hreflang

Last updated on