Check 28.02 · Multilingual linking and schema

Fix links to the default language

Find the links in translated versions that point to the default language, replace them with the translated page or remove them, templates included.

Priority
Important
Difficulty
Intermediate
Estimated time
3 h to 2 days
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

On most multilingual sites, link leaks go one way: from the translated versions to the default language, the one the site was written in. The task is to list these links, find for each one the equivalent page in the source page's language, then fix them: replace the URL when the translation exists, remove or flag the link when it does not, and fix the template when the link comes from it. Once it is done, a German page only links to a French page through the language switcher or through a deliberate, clearly announced link.

Why it matters

Links to the default language have mechanical causes, which repeat with every new translation:

  • the translator, human or machine, translates the text and keeps the original URL;
  • a template contains a relative link without a prefix (/contact/) that always leads to the language served at the root;
  • a custom menu link was entered once, hard-coded, in the original language;
  • untranslated content is replaced by a link to the original version.

Google determines the language of a page from its visible content and recommends links to a page's other language versions, not internal linking that mixes languages. Each link from a German page to a French page switches the visitor's language without their choosing, takes an internal link away from the German version and gives one more to the default language, which is already the best connected. On a recent version, these links can make up a large share of the internal linking, and some translated pages are no longer linked from any page in their language: see identify orphan pages by language (opens in a new tab).

What it improves

  • Visitor journey No more unintended switches to the original language.
  • Internal linking of each version Translated pages receive the links that belong to them.
  • Crawling Crawlers that follow the links of a version stay in it and discover the translated pages there.
  • Perceived translation quality, for visitors and reviewers alike. A plausible effect on conversion, not measured in isolation.
  • Rankings An indirect effect only.

How to check

Use the matrix of links by language described in favor links to the same language (opens in a new tab): it produces liens-hors-langue.csv, the list of links whose target language differs from the source language, switcher excluded. Filter the rows whose target language is the default language.

Then diagnose the cause from the distribution:

Clue in the export Likely cause
Same destination from every page of a language, Navigation or Footer position Template, menu or footer
Destination linked from a few pages, Content position Link entered in the content and not adapted
Destination with no equivalent in the language Missing translation, fallback link
Relative link without a prefix in the source code Link hard-coded in the theme

To check a page, view its source code and look for href="/ followed by a path with no language prefix, or href="https://example.com/ followed by a path in the default language.

Expected result: no row pointing to the default language, apart from listed and justified exceptions.

How to implement

Step 1 — Build the mapping table

To replace a link, you need to know the translated URL of each page. If your sitemaps carry hreflang annotations, this dependency-free Python script builds the table and suggests a replacement for each link in liens-hors-langue.csv:

#!/usr/bin/env python3
"""Usage: python3 remplacer.py https://example.com/sitemap.xml liens-hors-langue.csv"""
import csv
import gzip
import sys
import urllib.request
import xml.etree.ElementTree as ET

SM = "{http://www.sitemaps.org/schemas/sitemap/0.9}"
XHTML = "{http://www.w3.org/1999/xhtml}"


def fetch(url):
    request = urllib.request.Request(url, headers={"User-Agent": "audit-liens"})
    with urllib.request.urlopen(request) as response:
        data = response.read()
    return gzip.decompress(data) if data[:2] == b"\x1f\x8b" else data


def collect(url, table):
    root = ET.fromstring(fetch(url))
    for loc in root.findall(f"{SM}sitemap/{SM}loc"):
        collect(loc.text.strip(), table)
    for entry in root.findall(f"{SM}url"):
        alternates = {
            link.get("hreflang").lower().split("-")[0]: link.get("href")
            for link in entry.findall(f"{XHTML}link")
            if link.get("rel") == "alternate" and link.get("hreflang") != "x-default"
        }
        for href in alternates.values():
            table.setdefault(href, {}).update(alternates)
    return table


table = collect(sys.argv[1], {})
writer = csv.writer(sys.stdout)
writer.writerow(["source", "destination", "langue_source", "remplacement"])

with open(sys.argv[2], encoding="utf-8") as handle:
    for row in csv.DictReader(handle):
        target = table.get(row["destination"], {}).get(row["langue_source"], "NO TRANSLATION")
        writer.writerow([row["source"], row["destination"], row["langue_source"], target])
python3 remplacer.py https://example.com/sitemap.xml liens-hors-langue.csv > corrections.csv

If the hreflang annotations are in the HTML rather than in the sitemap, export them from the Hreflang tab of Screaming Frog, after ticking Store Hreflang and Crawl Hreflang in Configuration > Spider > Crawl, or from the CMS.

Step 2 — Decide what to do when the translation does not exist

Situation Decision
Content link to a page with no translation, secondary page Remove the link or replace it with a related translated page
Link to an important untranslated page Translate the page, then replace the link
Useful resource with no planned equivalent (documentation, study) Keep the link while flagging the language: “(in French)” and hreflang="fr" on the link
Menu or footer link to a page with no translation Remove the entry from that language's menu
Legal page (legal notice, terms of sale) Create the version adapted to the country, see translate anchors, menus and footer (opens in a new tab)

Missing translations in general are covered in plan for missing translations (opens in a new tab).

Warning: do not fix these links with a redirect that depends on the browser language or the IP address. Crawlers do not send this information and would always see the original page; see avoid forced redirects based on browser language (opens in a new tab).

Step 3 — Fix the templates first

One fixed template link settles hundreds of rows at once. In the theme, replace each hard-coded internal URL with a URL generated for the current language, as described for each CMS and framework in favor links to the same language (opens in a new tab). Look for candidates in the code:

grep -rn --include='*.php' --include='*.twig' --include='*.liquid' --include='*.blade.php' --include='*.tsx' -E 'href="/[a-z0-9-]+' themes/ resources/ src/ 2>/dev/null

Then the menus: a custom link entered in the original language must be recreated in the menu of each language.

Step 4 — Fix the content

Work from corrections.csv, language by language, starting with the pages that get the most visits. The method depends on the environment, detailed below; step 5 comes after.

WordPress

Versions WordPress 6.8 and later (checked up to 7.1); WPML 4 and 5, Polylang 3, WP-CLI 2.

With WPML, start with WPML > Settings, “Translate Link Targets” section, button to scan and adjust links: WPML points the links in the content to the existing translations. Then run the crawl again: links in page builder fields can escape it.

For the rest, and with Polylang, this WP-CLI script replaces the URLs listed in corrections.csv in the content of a single language, in dry-run mode by default. Back up the database first (wp db export).

<?php
// Usage: wp eval-file corriger-liens.php de corrections.csv [apply]
[$lang, $file] = $args;
$apply = ($args[2] ?? '') === 'apply';

$map = [];
$handle = fopen($file, 'r');
fgetcsv($handle);

while (($row = fgetcsv($handle)) !== false) {
    [, $old, $rowLang, $new] = $row;

    if ($rowLang !== $lang || ! str_starts_with($new, 'http')) {
        continue;
    }

    $map["href=\"{$old}\""] = "href=\"{$new}\"";
    $map['href="' . wp_make_link_relative($old) . '"'] = "href=\"{$new}\"";
}

do_action('wpml_switch_language', $lang);

$ids = get_posts([
    'post_type' => 'any',
    'post_status' => 'publish',
    'numberposts' => -1,
    'fields' => 'ids',
    'lang' => $lang,
    'suppress_filters' => false,
]);

foreach ($ids as $id) {
    $content = get_post_field('post_content', $id);
    $fixed = strtr($content, $map);

    if ($fixed === $content) {
        continue;
    }

    WP_CLI::log("Content {$id}: links to fix");

    if ($apply) {
        wp_update_post(['ID' => $id, 'post_content' => $fixed]);
    }
}
wp eval-file corriger-liens.php de corrections.csv
wp eval-file corriger-liens.php de corrections.csv apply

The lang parameter is for Polylang; suppress_filters and the wpml_switch_language action are for WPML. The script only handles post_content: content from Elementor or other page builders, stored in metadata, is fixed in the translation's editor. Each update creates a revision, which lets you roll back.

Shopify

Versions Online Store 2.0 themes and the Translate & Adapt app, all Shopify plans, November 2026.

Links entered in translated descriptions, pages and blog posts are fixed in Translate & Adapt: open the resource, target language, and replace the URL in the translated field. In the theme, replace hard-coded paths with {{ product.url }}, {{ collection.url }} or the routes object, which take the language into account.

PrestaShop

Versions PrestaShop 8 and 9.

Each description field exists per language: open the product or CMS page, choose the language in the field's language selector, and replace the links. In link modules (Link Widget, main menu), check that a custom URL is entered for each language.

Drupal

Versions Drupal 10 and 11.

Open the content's “Translate” tab, edit the translation and fix the links in the body. For menu links, make custom menu links translatable, then translate their target.

Webflow

Versions Webflow with Localization, paid site plans, November 2026.

Replace links entered as URLs with “Page” or “Collection page” links: only those point to the current locale.

Laravel

Versions Laravel 11 to 13.

In content stored in the database, save a reference to the page (its identifier) rather than its URL, and resolve it at render time with route() in the current language. To fix existing content, apply corrections.csv in an Artisan command that only loads the content of the language concerned, with a dry-run option enabled by default, modeled on the WordPress script above.

Next.js

Versions Next.js 15 and 16 (App Router), next-intl 4.

In content coming from a headless CMS, transform internal links at render time with next-intl's Link, which adds the current language's prefix. Absolute links to the default language must be fixed in the CMS, field by field.

Step 5 — Prevent it from coming back

  • Add to the translation brief: “replace each link with the URL of the page in the target language”.
  • Run the matrix again after each batch of translations and at each scheduled crawl.
  • Block any new hard-coded template link during acceptance testing, see test cross-language links (opens in a new tab).

Common mistakes

  • Replacing a URL globally across the whole database: the original page, which legitimately links to its own language, gets broken in turn.
  • Forgetting relative links: the content contains /tarifs/, the crawl export https://example.com/tarifs/.
  • Replacing with the language's homepage when the translation is missing: the link becomes misleading.
  • Fixing content before templates: most rows come back at the next crawl.
  • Ignoring page builders and custom fields, which replacement tools do not read.
  • Not purging caches after the fix: the old version keeps being served.

Frequently asked questions

Updated on

Topic checklist (PDF)

And now?

In the “Multilingual linking and schema” topic

  1. Favor links to the same language
  2. Fix links to the default language
  3. Translate anchor text
  4. Check the language switcher on every page
  5. Check related content, footer and in-article links
  6. Identify orphan pages by language
  7. Build clusters for each market
  8. Check click depth and link equity distribution
  9. Use inLanguage on compatible types
  10. Translate name and description
  11. Adapt url to the language
  12. Keep a stable organization @id
  13. Create a distinct @id for each page
  14. Translate FAQ and Article markup
  15. Adapt Product and priceCurrency
  16. Adapt areaServed and contact details
  17. Check availability by country
  18. Check sameAs
  19. Validate the markup for each language