Check 23.10 · Hreflang and regional variants

Check that targets are indexable

Make every URL in your hreflang indexable: no noindex, no X-Robots-Tag, no robots.txt block, no canonical elsewhere, on the server, CMS or framework.

Priority
Critical
Difficulty
Intermediate
Estimated time
1 to 3 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

A URL listed in an hreflang annotation must be able to enter the index: crawlable (not blocked by robots.txt), with no noindex directive in the HTML or in the X-Robots-Tag header, and canonical, meaning its canonical tag points to itself. The task is to check these four points for every target, then fix either the directive or the annotation. Once done, each announced version can be indexed and shown to its intended audience.

Why it matters

hreflang only switches between pages that are already indexed. Google's John Mueller pointed out in 2025 that hreflang does not guarantee indexing, and Google has already stated that it only processes a page's annotations once that page is indexed. A non-indexable target therefore has nothing to offer the group.

Each block breaks the mechanism in its own way:

  • robots.txt: Google cannot crawl the page, so it can neither read its return link nor know its content. It may even index the URL without any content.
  • noindex (meta tag or X-Robots-Tag header): the page is crawled, then excluded from the index. Google's Gary Illyes explained in 2022 on the Search Off the Record podcast that, since pages in an hreflang group can influence one another, a noindex on a single URL could in some cases affect the whole group. His advice: if you want to remove pages, put the noindex on each of them.
  • Canonical to another URL: the page declares itself a duplicate. Google selects the other URL, and the annotation points to a page that is not indexed under that address (see align hreflang and canonical (opens in a new tab)).

These situations often stem from a good intention that spread too far: a language set to noindex while it is being translated, a folder blocked in staging and then published, an SEO plugin that copies the original version's canonical into the translations.

What it improves

  • Indexing of every version The announced pages can be indexed and served to the right audience.
  • Consistent hreflang groups No more ghost versions skewing the return link check.
  • Crawl budget Fewer pages crawled for nothing on large multilingual sites.
  • Generative engines Indirect effect. Answer engines that rely on Google's or Bing's index can only cite an indexed page; citation is never guaranteed.
  • Rankings No direct effect on the position of a page that is already indexed.

How to check

1. On one page, without paid tools. This Python script (standard library only) reads a page's annotations and checks each target: HTTP status code, X-Robots-Tag, meta robots tag, canonical and robots.txt for Googlebot.

#!/usr/bin/env python3
"""Usage: python3 hreflang_indexable.py https://example.com/fr/tarifs/"""
import sys
import urllib.error
import urllib.request
from html.parser import HTMLParser
from urllib.parse import urlsplit
from urllib.robotparser import RobotFileParser


class NoRedirect(urllib.request.HTTPRedirectHandler):
    def redirect_request(self, req, fp, code, msg, headers, newurl):
        return None


class HeadParser(HTMLParser):
    def __init__(self):
        super().__init__()
        self.alternates = {}
        self.canonical = None
        self.robots = []

    def handle_starttag(self, tag, attrs):
        attributes = {name.lower(): (value or '') for name, value in attrs}
        rel = attributes.get('rel', '').lower()

        if tag == 'link' and rel == 'alternate' and 'hreflang' in attributes:
            self.alternates[attributes['hreflang']] = attributes.get('href', '')
        elif tag == 'link' and rel == 'canonical':
            self.canonical = attributes.get('href', '')
        elif tag == 'meta' and attributes.get('name', '').lower() in ('robots', 'googlebot'):
            self.robots.append(attributes.get('content', '').lower())


opener = urllib.request.build_opener(NoRedirect)
robots_files = {}


def fetch(url):
    request = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0 (audit hreflang)'})

    try:
        response = opener.open(request, timeout=20)
    except urllib.error.HTTPError as error:
        return error.code, error.headers, ''
    except urllib.error.URLError as error:
        return 0, {}, str(error.reason)

    return response.status, response.headers, response.read().decode('utf-8', 'replace')


def allowed_by_robots(url):
    parts = urlsplit(url)
    root = f'{parts.scheme}://{parts.netloc}'

    if root not in robots_files:
        robots = RobotFileParser(f'{root}/robots.txt')
        robots.read()
        robots_files[root] = robots

    return robots_files[root].can_fetch('Googlebot', url)


status, headers, html = fetch(sys.argv[1])
source = HeadParser()
source.feed(html)

for hreflang, url in sorted(source.alternates.items()):
    status, headers, html = fetch(url)
    page = HeadParser()
    page.feed(html)
    problems = []

    if status != 200:
        problems.append(f'HTTP {status}')

    if 'noindex' in (headers.get('X-Robots-Tag') or '').lower():
        problems.append('X-Robots-Tag noindex')

    if any('noindex' in content for content in page.robots):
        problems.append('meta robots noindex')

    if page.canonical and page.canonical != url:
        problems.append(f'canonical to {page.canonical}')

    if not allowed_by_robots(url):
        problems.append('blocked by robots.txt')

    print(f"{'OK    ' if not problems else 'ALERT '} {hreflang:10} {url} {'; '.join(problems)}")

Expected result: one OK line per version. Python's robotparser module does not handle every pattern (*, $): confirm any doubt with the robots.txt report in Search Console.

2. Across the whole site. In Screaming Frog, with hreflang crawling enabled (Configuration > Spider > Crawl), the Hreflang tab offers the filters “Noindex Return Links” (targets set to noindex), “Non-Canonical Return Links” (targets that are not canonical) and “Non-200 Hreflang URLs”. To see targets blocked by robots.txt, let the tool respect the file: they show up as blocked.

3. In Search Console. Inspect one URL from each version with the URL Inspection tool: the indexing section shows whether crawling is allowed, whether indexing is allowed and which canonical Google selected. The Page indexing report groups the reasons “Excluded by ‘noindex’ tag”, “Blocked by robots.txt” and “Alternate page with proper canonical tag”. Filter by language folder to spot an entire version that is affected.

How to implement

Before you start

For each non-indexable target, decide:

Finding Should the page be indexed? Action
noindex on a published, finished translation Yes Remove the noindex
noindex on a translation in progress or partial Not for now Remove the page from the annotations of the whole group
Language folder blocked in robots.txt Yes Remove the Disallow rule
Canonical to the version in another language Yes Self-referencing canonical
Canonical to a variant of the same page (parameters) No List the canonical URL in the annotations
Staging or test version No Remove from the annotations, protect with authentication

The overall rule: an hreflang group contains only indexable pages, and each indexable page in a group announces the others. If you want to remove an entire group from the index, put noindex on all of its pages, as Google advises, and remove the annotations. See also check noindex by language (opens in a new tab).

Warning: never block in robots.txt a page you want to deindex with noindex: once blocked, it is no longer crawled and Google never sees the directive.

Apache

Versions Apache 2.4.

Look for X-Robots-Tag headers set in the configuration, for example on a language folder left in staging:

sudo grep -rn -i "X-Robots-Tag" /etc/apache2/ /var/www/*/.htaccess 2>/dev/null

A rule like this makes the entire German version non-indexable:

<If "%{REQUEST_URI} =~ m#^/de/#">
    Header set X-Robots-Tag "noindex"
</If>

Delete it if the version is published, or remove /de/ from the annotations if it is not. Reload with sudo apachectl configtest && sudo systemctl reload apache2.

Nginx

Versions Nginx 1.18 and later.

sudo grep -rn -i "X-Robots-Tag" /etc/nginx/

Look for add_header X-Robots-Tag "noindex" in a language location block or in a subdomain server block (de.example.com). Delete the line or adjust the annotations, then run sudo nginx -t && sudo systemctl reload nginx. Check the result:

curl -s -I https://example.com/de/preise/ | grep -i "x-robots-tag"

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

A transform rule can add X-Robots-Tag to the response without the server knowing. Open the Rules overview, then the Response Header Transform Rules, and look for X-Robots-Tag. Also check any Workers that rewrite headers or HTML. Purge the cache for the affected URLs after the fix.

robots.txt

Look for rules that affect a language folder or subdomain:

curl -s https://example.com/robots.txt | grep -i -E "^(user-agent|disallow)"
curl -s https://de.example.com/robots.txt | grep -i -E "^(user-agent|disallow)"

Each subdomain has its own file. A Disallow: /de/ line, or a Disallow: / left on de.example.com after launch, blocks the entire version. Delete the rule, then check the file in Search Console's robots.txt report (Settings > robots.txt).

WordPress

Versions WordPress 6.4 to 7.1; Yoast SEO, Rank Math, WPML 4 and 5, Polylang 3, November 2026.

  • Global visibility: in Settings > Reading, the “Discourage search engines from indexing this site” box must be unchecked. With one domain per language on multisite, check each site.
  • Per-content setting: in Yoast SEO (Advanced tab of the Yoast box) or Rank Math (Advanced tab, Robots Meta), each translation has its own indexing setting. A translation can be set to noindex while the original is not.
  • WPML: in WPML > Settings, Custom Fields Translation section, check the mode of the SEO plugin fields (for example _yoast_wpseo_meta-robots-noindex and _yoast_wpseo_canonical). In “Copy” mode, the original's setting overwrites that of each translation, canonical included.
  • Polylang: each translation is a separate piece of content with its own SEO settings; check them one by one or through the SEO plugin's column in the content list.

Multilingual plugins all announce every published translation, regardless of the noindex set by the SEO plugin: keeping the two consistent is up to you.

Shopify

Versions Shopify admin and Online Store 2.0 themes, all plans, November 2026.

The built-in way to hide a page is the seo.hidden metafield (value 1), which adds noindex, nofollow and removes the resource from the sitemap. It applies to the resource in every market and every language: you cannot use it for a single language, which keeps the group consistent. Do check, however, the theme's robots.txt.liquid file if it has been customized, and any theme code that might add a noindex tag depending on the language (request.locale).

Laravel

Versions Laravel 10 to 13. The middleware is the same everywhere; only its registration changes from Laravel 11 onwards.

noindex outside production is often set by a middleware. It must depend on the environment, never on the language:

// app/Http/Middleware/AddRobotsHeader.php
namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class AddRobotsHeader
{
    public function handle(Request $request, Closure $next): Response
    {
        $response = $next($request);

        if (app()->isProduction()) {
            return $response;
        }

        $response->headers->set('X-Robots-Tag', 'noindex, nofollow');

        return $response;
    }
}

In templates, output the noindex meta robots tag only for explicit cases (internal search, account), and exclude those pages from the component that generates the hreflang annotations.

The middleware must apply to every response. Once it is registered, curl -s -I https://example.com/de/preise/ | grep -i "x-robots-tag" must return nothing in production. Registration is the only step that depends on the version.

Laravel 11 to 13

Since Laravel 11, app/Http/Kernel.php no longer exists: register the middleware globally in bootstrap/app.php.

use App\Http\Middleware\AddRobotsHeader;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    // ->withRouting(...)
    ->withMiddleware(function (Middleware $middleware): void {
        $middleware->append(AddRobotsHeader::class);
    })
    // ->withExceptions(...)
    ->create();

Laravel 10 and earlier

Add the middleware to the global stack, in app/Http/Kernel.php:

protected $middleware = [
    // … existing middleware
    \App\Http\Middleware\AddRobotsHeader::class,
];

Next.js

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

Check three places:

  • robots in the metadata: an index: false value set in a language layout (app/[locale]/layout.tsx) applies to every page in that language.
  • app/robots.ts: check that no disallow rule targets a language prefix.
  • Headers: the headers() in next.config.js (or next.config.ts) and the proxy.ts file (named middleware.ts before Next.js 16) can add X-Robots-Tag.
// app/[locale]/layout.tsx: keep noindex for test environments only
import type { Metadata } from 'next';

export const metadata: Metadata = {
  robots: process.env.VERCEL_ENV === 'production'
    ? { index: true, follow: true }
    : { index: false, follow: false },
};

VERCEL_ENV only exists on Vercel; elsewhere, use your own environment variable.

Common mistakes

  • Setting a language to noindex during translation without removing its annotations from the other versions.
  • Blocking a language folder in robots.txt to deindex it: Google no longer sees either the noindex or the return link.
  • Forgetting the language subdomain's robots.txt, left in staging mode.
  • Copying the original's SEO settings into the translations, canonical included.
  • Only looking at the meta tag: an X-Robots-Tag set by the server or the CDN does not appear in the source code.
  • Keeping a version deliberately set to noindex in the group: remove it from the annotations of every other page.

Frequently asked questions

Can a noindex page be part of an hreflang group?

No, an hreflang target must be indexable. Google only processes hreflang annotations on indexed pages, and a noindex page is excluded from the index. Google's Gary Illyes even said that a noindex on a single URL in a group could in some cases affect the whole group. Remove the noindex page from the annotations of every other version, or remove the noindex if the translation is ready.

Should you block a language that is not yet translated in robots.txt?

No. A page blocked in robots.txt is no longer crawled, but Google may index its URL without content, and it never sees any noindex. For a language that is not ready yet, it is better not to publish the pages, or to protect them with authentication, and to leave them out of the hreflang annotations and the sitemap until they are published.

How can you tell whether Google considers a language version indexable?

Search Console's URL Inspection tool shows, for a given URL, whether crawling and indexing are allowed and which canonical Google selected. The Page indexing report groups URLs excluded by noindex, blocked by robots.txt or declared as duplicates. Filter it by language folder or subdomain to spot an entire version that is affected.

Why is a translation flagged as a duplicate in Search Console?

Two causes dominate. Either the translation carries a canonical to the version in another language, often copied from the original by the SEO or multilingual plugin. Or the versions are almost identical, for example two regional variants of the same language, and Google keeps only one of them as canonical. In the second case, hreflang can still show the right URL, but the reports focus on the canonical.

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