Hreflang and canonical tags: configuring a multilingual website
For a website in French and English, publish each translation at a distinct URL. Connect equivalent pages with hreflang and choose a canonical URL for each piece of content. In the usual case of two complete translations, the French page declares its own canonical URL and the English page does the same.
Check that Google can fetch the pages and that your CMS preserves these relationships when you change a URL or remove a translation. The example.com domains represent a fictional website.
Hreflang versus canonical: what each tag tells Google
With hreflang, you declare the language or regional variants of the same content. With rel="canonical", you indicate your preferred URL for content available at several addresses. Google considers these signals but may choose a different canonical URL. Google’s canonical URL documentation.
A French page and its English translation
Setup to plan — Two distinct canonical URLs connected through hreflang
The same French page with and without a tracking parameter
Setup to plan — One preferred French URL; the tracking variant can declare that URL as canonical
Two French regional variants with similar content
Setup to plan — Assess the useful differences, select an appropriate canonical and declare the regional variants
An old article merged into a guide
Setup to plan — A permanent redirect to the equivalent guide, followed by updates to links and annotations
A complete translation is not a duplicate just because it covers the same subject in another language. Google distinguishes this from pages where only the navigation changes language. Missing hreflang therefore does not justify a claim that translations attract a “duplicate-content penalty”. Documentation on localized versions.
Choosing fr, en, fr-CH or en-CH
Choose codes according to the audience for each version:
fr: content for French speakers without explicit regional targeting.
en: content for English speakers without explicit regional targeting.
fr-CH: French content for the Swiss market.
en-CH: English content for the Swiss market.
The country code is optional. A Swiss company can use fr and en when these versions also serve readers abroad. Your Geneva address or domain extension does not oblige you to create a separate URL for each country.
If you publish regional versions, also decide which version to offer other speakers of that language. For instance, you can assign fr-CH and fr to the same URL when it serves both audiences. Document the choice so developers and content owners follow the same rule. Google recommends a generic language version when a website has several regional versions of that language. Supported codes and variants.
Use language-country syntax such as fr-CH, rather than a country code alone. For a bilingual website, declare the languages you publish. No SEO rule requires you to add every Swiss national language.
If your French page serves both Swiss and international readers, you can keep its fr annotation and add this annotation on both pages in the group:
<link rel="alternate" hreflang="fr-CH"
href="https://example.com/fr/services/sites-web">
Both French codes refer to the same page here. Create another regional URL when your offer or content warrants a distinct version.
Preparing a translation map
Before changing the code, collect the relationships between your pages. Use the content identifier in your CMS rather than similarities between URL slugs.
service-web — both translations published
FR: https://example.com
EN: https://example.com
guide-budget — French published
FR: https://example.com
EN: no published translation.
guide-seo — merger to prepare
Record the old French URL and old English URL. Prepare the merger in both languages.
For each row, add the canonical URL, language code, any x-default and the person responsible. This map helps you spot a missing translation before the CMS generates a link to a page that does not exist.
Connect a service page to its English equivalent. Linking that page to the English homepage does not supply a translation of the service. For content and navigation planning, see our guide to creating a multilingual website.
Example HTML annotations for two FR/EN pages
This example uses fr and en. Put the tags in each page’s <head>, keeping the same two hreflang relationships.
On the French page
<html lang="fr">
<head>
<title>Création de sites web</title>
<link rel="canonical"
href="https://example.com/fr/services/sites-web">
<link rel="alternate" hreflang="fr"
href="https://example.com/fr/services/sites-web">
<link rel="alternate" hreflang="en"
href="https://example.com/en/services/websites">
</head>
On the English page
<html lang="en">
<head>
<title>Website development</title>
<link rel="canonical"
href="https://example.com/en/services/websites">
<link rel="alternate" hreflang="fr"
href="https://example.com/fr/services/sites-web">
<link rel="alternate" hreflang="en"
href="https://example.com/en/services/websites">
</head>
Each page references itself and its translation. The hreflang URLs must be absolute. Google also accepts alternate pages on different domains; you still need return links between them. HTML implementation rules.
For canonicals, Google also recommends absolute URLs while supporting relative ones. Using the same absolute format in your CMS simplifies checks and helps avoid retaining a staging address during deployment. Canonical recommendations.
The HTML lang attribute helps assistive technologies read your content in the right language. Keep it even though Google says it detects language from the content rather than this attribute or hreflang. Managing multilingual websites.
Adding x-default when you have chosen a fallback
x-default is optional. You can choose a language selector or a version of the content for visitors whose language is absent from your annotations. In our example, if you choose English as the fallback, add this to both pages:
<link rel="alternate" hreflang="x-default"
href="https://example.com/en/services/websites">
This tag informs Google; it does not redirect the visitor’s browser. Google’s explanation of x-default.
Choosing an implementation your team can maintain
Google supports three ways to declare localized versions: HTML tags, HTTP headers and XML sitemaps. You can choose one method. Combining them provides no search benefit and creates more places to keep synchronized. Supported implementation methods.
Tags in the HTML head
Practical use — Pages generated by a CMS
What to check — Translation relationships and the contents of the head
XML sitemap
Practical use — Central generation of many URLs
What to check — An entry for each URL and the same variants in every entry
HTTP Link header
Practical use — Documents such as translated PDFs
What to check — Headers the server returns for each document
This minimal sitemap covers the two example pages. Each entry contains its own URL and both variants.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/fr/services/sites-web</loc>
<xhtml:link rel="alternate" hreflang="fr"
href="https://example.com/fr/services/sites-web"/>
<xhtml:link rel="alternate" hreflang="en"
href="https://example.com/en/services/websites"/>
</url>
<url>
<loc>https://example.com/en/services/websites</loc>
<xhtml:link rel="alternate" hreflang="fr"
href="https://example.com/fr/services/sites-web"/>
<xhtml:link rel="alternate" hreflang="en"
href="https://example.com/en/services/websites"/>
</url>
</urlset>
If you choose this method for hreflang, you can keep canonical tags in the HTML. The two annotations serve different purposes.
For two translated PDFs, the server can return the same header on each document:
Link: <https://example.com/fr/guides/seo.pdf>; rel="alternate"; hreflang="fr", <https://example.com/en/guides/seo.pdf>; rel="alternate"; hreflang="en"
This example declares the translations. If you also need an HTTP canonical, use a separate rel="canonical" relationship without adding hreflang to it. Canonicals in HTTP headers.
Handling cases that need a decision
A translation is missing
Publish the variants that exist. Do not add an annotation pointing to an empty English URL or a French page displayed under /en/. For a French-only guide, your language selector can explain that a translation is unavailable. Add reciprocal relationships when you publish the English version.
Several URLs show the same content
If ?utm_source=newsletter adds tracking information alone, you can retain the canonical URL without that parameter. If a parameter changes the content, examine what it produces before removing it from the canonical URL.
For paginated lists, Google recommends a canonical URL for each page: page 2 contains a different part of the list. Do not declare it a duplicate of page 1. Connect equivalent language variants when they correspond to the same content. Pagination guidance.
Two regional variants use the same language
Two French versions for different markets may have similar content. Google provides for combining a canonical preference with regional annotations in this case. Decide according to differences in content, offers or terms; the rule “every URL must point to itself” does not cover all regional duplicates. Handling regional duplicates.
The website forces a language based on location
Keep each translation accessible at its URL. Offer a language change without forcing visitors through a redirect based on their IP address. Google warns that content adapted to location or the Accept-Language header can prevent its crawlers from discovering all variants. Crawling locale-adaptive pages.
Validating the setup before and after publication
Assign these checks to a developer and your SEO owner. Test the relevant page templates first, then check the published URLs.
HTTP response
Expected result for our FR/EN example — Each final URL returns 200 without requiring a login
Content
Expected result for our FR/EN example — The body matches the declared language
Crawling and indexing
Expected result for our FR/EN example — No robots.txt block or noindex on pages intended for search
Canonical
Expected result for our FR/EN example — One consistent canonical, French on FR and English on EN
Hreflang
Expected result for our FR/EN example — Two absolute URLs, self references and return links
Language selector
Expected result for our FR/EN example — A link to equivalent content when available
Internal links and sitemap
Expected result for our FR/EN example — Final URLs consistent with the canonicals
New content
Expected result for our FR/EN example — Publishing a translation updates both versions
Removal or URL change
Expected result for our FR/EN example — Removal of old relationships and a redirect check
Inspect the returned HTML and the rendered HTML if your website uses JavaScript to change the head. To check indexing, use Search Console’s URL Inspection tool and compare the user-declared canonical with Google’s selected canonical. The live test reports current access; it does not prove that Google has adopted the new setup in its index. URL Inspection help.
Google needs to fetch a page to read a noindex instruction. A robots.txt block can prevent it from seeing that instruction. To consolidate duplicates, use the appropriate canonical preference; do not replace that decision with noindex on a translation you want people to find. Noindex documentation.
Search Console’s old International Targeting report is no longer available. Google still uses hreflang, but you need a crawl or validation tool to check the annotations. Report deprecation notice.
Diagnosing the wrong version in Google
Start with the affected URL, then examine its translation. Check the content, access, selected canonical and reciprocal relationships. A correct tag on the French page does not repair an English translation that returns 404.
Google selects an unexpected canonical
First check — HTML, headers, redirects and both pages’ content
Possible action — Correct conflicting signals and assess content differences
The translation does not appear in the index
First check — Access, noindex, robots.txt and translated content
Possible action — Restore access or complete the translation
A tool reports a missing return link
First check — Hreflang on the target page
Possible action — Generate annotations from the same CMS relationship
Tags retain an old URL
First check — Redirect and translation relationship
Possible action — Replace the target with its final URL
After a correction, Google needs to crawl the pages again. Passing validation does not guarantee a ranking or a processing deadline. Canonicalization troubleshooting.
Merging articles while preserving language destinations
Prepare an old URL → destination mapping for each language. For example, redirect an old French guide to the new French guide and do the same for English.
Before activating redirects:
1. Include the useful answers from each absorbed article in the final guide.
2. Publish the destinations and check their content, 200 response and indexability.
3. Configure permanent 301 redirects to the final destinations in one hop.
4. Update internal links, canonicals and hreflang relationships.
5. Remove absorbed URLs from the sitemap of indexable articles and test each redirect.
Keep a record of the old URLs and a baseline of the topic’s performance before the merger. You can then follow visits and queries across old and new URLs together, in each language. Google accepts redirects to relevant consolidated content and recommends keeping them for at least a year. URL change documentation. Our SEO migration guide covers preparation for a larger redesign.
Having your multilingual website checked
To prepare a launch or investigate incorrect language associations, gather your translation map and a few representative URLs. EWM can help with SEO and website design and development. Include these checks in your acceptance process for future CMS changes.