Course contentsShow
← Web Development
Lesson 2544 of 2,98245. InternationalizationFree lesson

Canonical URLs Across Locales

Set canonical tags correctly to avoid duplicate content penalties when content exists in multiple languages.

Canonical URLs Across Locales

You'll learn how to prevent search engines from penalizing your site for duplicate content when the same content exists in multiple languages.

The Duplicate Content Problem

When you serve the same (or very similar) content across different locale versions of your site, search engines may see these as duplicate pages. For example, /en/about and /fr/about might contain nearly identical information, just translated. Without proper signals, search engines might:

  • Index only one version arbitrarily
  • Split ranking signals across multiple URLs
  • Apply duplicate content penalties

What Canonical Tags Do

The <link rel="canonical"> tag tells search engines which URL is the "primary" version of a page. In multilingual sites, each locale version should point to itself as canonical, not to a single "master" language.

Think of it like this: Each translation is the authoritative version for its own language. You're not saying "the English version is the real one"—you're saying "this French page is the canonical French page."

Implementation Pattern

In your HTML <head>, each locale should declare itself canonical:

<!-- On /en/products -->
<link rel="canonical" href="https://example.com/en/products">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/products">

<!-- On /fr/products -->
<link rel="canonical" href="https://example.com/fr/products">
<link rel="alternate" hreflang="en" href="https://example.com/en/products">

Combine this with hreflang tags (from lesson 2542) to signal both canonicalization and language relationships. The canonical says "this is the right URL for this content," while hreflang says "here are the language variants."

Key Takeaway: Set each locale page's canonical URL to itself, not to a default language, to properly signal that each translation is the authoritative version for its language and avoid duplicate content issues.