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
- Canonical points to a 404 — the engine discards the signal.
- Every page canonicalises to the homepage — only the homepage gets indexed.
- Canonical uses http while the site runs https — the engine ignores it.