← Back to Index

Hreflang Tag

FigureHow Hreflang tags direct users to the correct version. A Spanish user (ES) gets the /es/ page; a British user (GB) gets the /uk/ page; everyone else gets the default.

What is the Hreflang Tag?

Hreflang is one of the most complex technical SEO elements to implement correctly. It effectively manages the relationship between equivalent content in different languages (e.g., English vs. Spanish) or regions (e.g., US English vs. UK English).

Without hreflang, Google might view your US and UK sites as duplicate content because the text is largely the same. Hreflang explicitly tells Google: "These aren't duplicates; they are targeted variations."

Why it Matters for SEO

1. User Experience & Bounce Rate

If a French user lands on your English page, they will likely bounce back to search results immediately. Hreflang ensures they land on the fr-fr version, increasing engagement and conversion rates.

2. Geo-Targeting

It allows you to rank for the same keywords in different countries with local currency, shipping info, and cultural nuances (e.g., "pants" in the US vs "trousers" in the UK).

Code Implementation

Hreflang can be implemented in the HTTP Header, Sitemap, or HTML Head. The HTML Head method is most common:

html
<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

Common Pitfalls & How to Fix

The "Return Tag" Error (Most Common)

The Mistake: Page A links to Page B, but Page B does not link back to Page A.

The Fix: Hreflang works in clusters. Every page in the group must list all other pages in the group, including itself. If the handshake isn't mutual, Google ignores the tags.

Incorrect Language Codes

The Mistake: Using en-UK instead of en-GB.

The Fix: You must use ISO 639-1 for language and ISO 3166-1 Alpha 2 for region. Always check the official ISO list.

Missing X-Default

The Mistake: Not defining a fallback page for users who don't match any specific language.

The Fix: Always include hreflang="x-default". This is usually your main homepage or a language selection menu.

How to Audit with Mygom

Mygom's check ensures that:

  1. The hreflang attribute is present.
  2. The language codes are valid format (e.g., xx-XX).
  3. Self-referencing tags are included.