Canonical URL

A canonical URL is the "primary" version of a page you tell search engines about via `<link rel="canonical">` to prevent duplicate-content indexation.

When you need it

Sites often have multiple URLs for the same page: with and without www, http vs https, trailing slash variants, UTM-tagged copies. The search engine should index one, not all. Via canonical you tell it which. Without canonical, Google and Yandex pick on their own, and not always the URL you wanted to surface.

How to set it

<link rel="canonical" href="https://example.com/article" />

Drop this tag inside `<head>` on every page. The URL must be absolute, include the protocol, and match what's in sitemap.xml. In Next.js use `alternates.canonical` in `generateMetadata()` — the framework emits the tag for you.

Common mistakes

See also

Canonical URL — SEO glossary