Check 23.03 · Hreflang and regional variants

Include the self-referencing annotation

Make each page appear in its own hreflang list, with its exact canonical URL, and fix the templates, CMSs and sitemaps that leave it out.

Priority
Critical
Difficulty
Easy
Estimated time
30 min to 2 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Every translated page must cite itself in its hreflang annotations, in addition to its other versions. The French page https://example.com/fr/tarifs/ therefore contains an hreflang="fr" line pointing to its own URL. Once the task is done, every version in a group carries exactly the same list, and each one appears in it with its canonical URL.

Why it matters

Google sets this as its first guideline, valid for all three methods (HTML tags, HTTP header, sitemap): each language version must list its own URL as well as the URLs of all the other versions.

The self-reference has two concrete roles:

  • It declares the page's code. The hreflang="fr-CH" line pointing to itself states which audience the page is intended for. The other versions must point to it with that same code; without a self-reference, there is no way to check this consistency.
  • It makes the list identical everywhere. A group whose pages all show the same list can be generated with a single template and checked at a glance. When each page leaves itself out, each version has a different list, and errors hide.

The omission almost always comes from the same place: a template that reuses the language switcher loop, designed to show only the other languages.

What it improves

  • Compliance with Google's guidelines The list is complete, as its documentation requires.
  • Reliable checks Audit tools (Screaming Frog, Merkle's tester) flag a missing self-reference; once it is fixed, the other alerts become readable.
  • Consistency with the canonical The self-referencing URL and the canonical are the same address, which avoids sending contradictory signals.
  • Rankings, AI answers No direct effect. It is a condition for the annotations to work properly, not a lever in itself.

How to check

For one page, look for its URL in its own annotations:

url=https://example.com/fr/tarifs/
curl -s "$url" | grep -o -i '<link[^>]*hreflang[^>]*>' | grep -F "\"$url\""

Correct result: one line, for example <link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs/">. No line means the self-reference is missing or the URL differs (trailing slash, http, www).

For a list of URLs (urls.txt, one per line):

while read -r url; do
  curl -s "$url" | grep -o -i '<link[^>]*hreflang[^>]*>' | grep -q -F "\"$url\"" || echo "No self-reference: $url"
done < urls.txt

A page with no annotations at all also shows up in the list: check separately whether it has translations.

Other ways:

  • Screaming Frog: with "Store Hreflang" and "Crawl Hreflang" ticked in Configuration > Spider > Crawl, the Hreflang tab's "Missing Self Reference" filter lists the affected pages.
  • Merkle's hreflang tester: checks a URL and shows its complete list.
  • Sitemap: each <url> block must contain an xhtml:link whose href is identical to its <loc>.

How to implement

Before you start

The rule is simple: the list shown on a page is the list for the whole group, current page included, and the current page's URL is exactly its canonical.

<link rel="canonical" href="https://example.com/fr/tarifs/">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs/">
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing/">
<link rel="alternate" hreflang="de" href="https://example.com/de/preise/">
<link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing/">

On the English page, the same list; the English URL appears twice, as en and as x-default, which is allowed.

In a sitemap, each <url> repeats its own address in its xhtml:link elements:

<url>
  <loc>https://example.com/fr/tarifs/</loc>
  <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs/"/>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/pricing/"/>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise/"/>
</url>

For a PDF announced by an HTTP Link header, the French file's header also cites the French file itself.

WordPress

Versions WordPress 6.8 and later; WPML 4 and 5, Polylang 3, TranslatePress 3, Weglot 6.

WPML, Polylang, TranslatePress and Weglot include the current page in the list as soon as the translations are linked. If it is missing, look for a second source of tags: a theme or a code snippet in functions.php that writes its own loop, often copied from a language switcher. Remove it and leave the multilingual plugin on its own. Also check that the page's language is not hidden or disabled in the plugin's settings.

Shopify

Versions Shopify with Shopify Markets, all plans, November 2026.

Shopify Markets' automatic tags cover every published version. A missing self-reference usually points to tags added to the theme or by an app, duplicating those from content_for_header: remove them.

Drupal

Versions Drupal 10 and 11; Hreflang module 8.x-1.x, or 2.x from Drupal 11.1.

Content Translation lists all the published translations of the entity, the current one included. If a view or listing page has no self-reference, it is not covered by core: configure the Hreflang module for those pages.

Laravel

Versions Laravel 11 to 13.

Keep the hreflang list separate from the language switcher list. The switcher can exclude the current language; the annotations cannot:

{{-- Switcher: the other languages only --}}
@foreach($alternates as $locale => $url)
    @continue($locale === app()->getLocale())
    <a href="{{ $url }}" hreflang="{{ $locale }}">{{ strtoupper($locale) }}</a>
@endforeach

{{-- Annotations: every version, current page included --}}
@foreach($alternates as $locale => $url)
    <link rel="alternate" hreflang="{{ $locale }}" href="{{ $url }}">
@endforeach

Build $alternates from the full group of published translations, without filtering out the current page, and use the same URL for the canonical: <link rel="canonical" href="{{ $alternates[app()->getLocale()] }}">.

Symfony

Versions Symfony 6.4, 7.4 and 8.x.

In Twig, the same separation: the tag loop goes through every locale with no if locale != app.request.locale condition. Generate the URLs with url() so that they are absolute and identical to the canonical.

Next.js

Versions Next.js 15 and 16 (App Router).

The alternates.languages object must contain the current language, with the same URL as alternates.canonical:

return {
  alternates: {
    canonical: languages[lang],
    languages,
  },
};

A common mistake is to build languages by filtering out the current language (Object.entries(all).filter(([l]) => l !== lang)), as for a switcher. Remove that filter.

Nuxt

Versions Nuxt 4, @nuxtjs/i18n module 10.

useLocaleHead() from @nuxtjs/i18n produces one tag for each configured locale, the current one included. If the self-reference is missing, check that you are not filtering head.link in the template, and that the current locale does have a language property in nuxt.config.ts.

Astro

Versions Astro 5 to 7, @astrojs/sitemap integration 3.

The component that writes the tags receives every version, current page included. With the i18n option of @astrojs/sitemap, the self-reference is included in each <url> block of the sitemap.

Common mistakes

  • Reusing the language switcher loop, which excludes the language being displayed.
  • A self-reference to a different form of the URL than the canonical: http://, without www, without the trailing slash, with tracking parameters.
  • A different code for itself and for the others: the page declares itself fr while the other versions cite it as fr-FR.
  • A self-reference as x-default only: the page must also appear with its language code.
  • Adding tags to pages without translations to "keep things tidy": an isolated self-reference serves no purpose, and a list pointing to non-equivalent pages is wrong.

Frequently asked questions

Is the self-referencing hreflang tag mandatory?

Yes, according to Google's documentation: each language version must list its own URL in addition to those of all the other versions, whichever method is used, HTML tags, HTTP header or sitemap. The self-reference declares the page's language and region code and makes the list identical on every version, which makes generation and checks easier.

Should a page without a translation have an hreflang tag pointing to itself?

No. A page that exists in only one language belongs to no group: an hreflang tag that points only to itself adds nothing. Add the annotations, self-reference included, on the day a genuinely equivalent translation is published. Never link a page to a translation of other content or to another language's homepage to fill the gap.

Does the hreflang self-reference replace the canonical tag?

No, the two tags have different roles and complement each other. The canonical designates the reference URL among duplicates; the hreflang annotation links language versions together. On a translated page, both point to the same address: the canonical to the page itself, and the hreflang line for its language to the page itself too. Any mismatch between the two is an error to fix.

Can a page appear twice in its hreflang list?

Yes, that happens with x-default. If the English version also serves as the default version, it appears twice in the list of every page in the group: once with the en code, once with x-default, with the same URL. However, the same URL must not carry two different language codes, such as fr and de.

Updated on

Topic checklist (PDF)

And now?

In the “Hreflang and regional variants” topic

  1. Implement hreflang for equivalent pages
  2. Check reciprocity
  3. Include the self-referencing annotation
  4. Use absolute URLs
  5. Validate ISO 639-1 language codes
  6. Validate ISO 3166-1 Alpha-2 country codes
  7. Use en-GB rather than en-UK
  8. Use x-default if relevant
  9. Check that targets return HTTP 200
  10. Check that targets are indexable
  11. Exclude redirects and nonexistent pages
  12. Align hreflang and canonical
  13. Automate annotations through the CMS
  14. Update annotations when a translation is removed
  15. Use HTTP headers for PDFs if needed
  16. Check consistency across HTML, HTTP header and sitemap methods if combined
  17. Test same-language variants for different countries