Internationalization

Hreflang Alternate Tag Generator

Generate accurate alternate language tags and sitemap markup to ensure search engines show the correct page version to international visitors.

Translation Paths

Important Notes

  • Each language page must have **reciprocal links** referencing all other alternate variations (including itself).
  • Always include a default fallback page with the code x-default for unmatched user locations.

Hreflang Tags & International SEO: Target Local Queries Safely

If your website serves visitors in multiple countries or translates its content into different languages, you face a major technical challenge. Search engine bots crawling your site will encounter highly similar or identical layouts translated into English, Spanish, German, or tailored to regional variations like English (US) vs. English (UK). Without proper directives, search engines will struggle to identify which version to index, often flagging your translations as duplicate content and ranking only one page.

The solution is **hreflang attributes**. Introduced by Google in 2011, hreflang tags instruct search engines on the exact language and geographical targeting of a URL, making sure international visitors see the correct localized version of your site in their search results.


1. The Structure of Hreflang Tags

Hreflang tags are declared as alternate links inside the HTML header:

<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="x-default" href="https://example.com/" />

Each directive requires three core properties:

  1. rel="alternate": Informs search engines that the URL is an alternate path.
  2. hreflang="[lang]-[country]": Specifies the targeting. The language code must comply with the ISO 639-1 standard, and the optional region code must comply with the ISO 3166-1 Alpha-2 standard (e.g. `en-us` for English in the United States, or `es-es` for Spanish in Spain).
  3. href="[url]": The absolute URL of the corresponding localized page version.

2. The x-default Fallback Tag

The x-default value is a critical fallback parameter. It instructs search engines which page version to show when a user's language setting does not match any of your declared hreflang codes (e.g., a French or Japanese speaker visiting a site that only has English and Spanish versions).

"Always assign an x-default tag. Typically, this points to your global homepage or a dedicated language selector landing page where users can choose their preferred localized experience manually."

3. Implementation Rules: HTML vs. XML Sitemaps

You can configure hreflang directives using two primary integration setups:

  • HTML Head Integration: Easy to configure for small sites. Place all alternate tags inside the <head> of every single translated page.
  • XML Sitemap Integration: Recommended for large e-commerce platforms. Declaring hreflangs inside your sitemap XML avoids bloating your page header payload sizes. The syntax requires nesting alternate XHTML links inside each page node:
    <url>
      <loc>https://example.com/en/</loc>
      <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/"/>
      <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
    </url>

4. Common Hreflang Mistakes

Error TypeTechnical CauseSEO Solution
Missing Reciprocal LinksPage A links to Page B, but Page B does not link back to Page A.Google ignores hreflang tags if they do not reciprocal link. Every alternate page must list every other page.
Invalid Region CodesUsing `en-uk` for United Kingdom (UK instead of GB) or `en-eu` for Europe.Always verify codes against ISO registries. UK must be declared as `gb` (Great Britain).
Relative URL PathsUsing path slugs like `/es/article` inside the href attribute.Ensure links include the full protocol and domain name: `https://example.com/es/article`.

5. FAQ Section

Q: Does implementing hreflang improve my page authority?

No. Hreflang tags do not pass link equity or improve page authority metrics. Their primary function is to direct search engines to show the correct local version of a page, preventing users from bouncing due to language mismatches.

Q: What happens if I target countries without targeting languages?

Hreflang cannot be used to target a country code alone. You must always define the language code first (e.g. `hreflang="us"` is invalid; write `hreflang="en-us"`).

Q: How do I test my hreflang tags for errors?

Use Google Search Console's "International Targeting" reports to verify if Google has successfully crawled your alternate links and check for any reciprocal verification failures.