SEO Small

Canonical link: what it is and how to add it

Add a canonical link

A canonical link tells search engines which URL is the authoritative version when the same or near-identical content is reachable at multiple URLs, with tracking parameters, trailing slashes, or http vs https, for example. Without it, ranking signals (links, authority) get split across duplicates instead of consolidating on one page.

Find out whether your site has this problem, and every other check, in one free scan.

Check your site free

Why it matters

Without a canonical tag, search engines can split ranking signals across near-duplicate URLs (with tracking params, trailing slashes, etc.), diluting the page's authority.

How to fix

  1. 1 Add <link rel="canonical" href="..."> pointing to the preferred URL.
  2. 2 Make sure the canonical URL matches the one you actually want indexed.

Fix it in your stack

HTML

Inside <head> on every page, pointing at that page's own preferred URL.

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

Next.js

App Router: set metadataBase once in the root layout, then a path per page.

// app/layout.tsx
export const metadata = { metadataBase: new URL('https://example.com') };

// app/pricing/page.tsx
export const metadata = { alternates: { canonical: '/pricing' } };

WordPress

WordPress prints a canonical on single posts and pages. An SEO plugin such as Yoast SEO or Rank Math adds it to archive pages and lets you override it per page under the advanced settings of the editor panel.

Nginx

For files that have no <head>, such as PDFs, send the canonical as a Link header.

location = /guide.pdf {
    add_header Link '<https://example.com/guide.pdf>; rel="canonical"';
}

Common mistakes

  • Pointing the canonical at the wrong URL (e.g. a staging or parameterized URL) due to a templating bug, which tells search engines to ignore the real page.
  • Adding a self-referencing canonical to every page correctly, but forgetting paginated or filtered variants that should instead canonicalize back to the main listing page.
  • Setting a canonical that conflicts with the URL declared in the sitemap or Open Graph tags, sending mixed signals.

How to verify

  1. 1 View page source and confirm <link rel="canonical" href="..."> points at the intended, preferred URL.
  2. 2 Load a few known duplicate variants of the page (with query params, trailing slash, etc.) and confirm they all canonicalize to the same URL.
  3. 3 Cross-check the canonical URL against the sitemap.xml entry for consistency.

Questions

What is a canonical link?
A <link rel="canonical"> element names the main URL of a page when the same content is reachable at several addresses: with and without www, with tracking parameters, or with a trailing slash. Search engines use it to pick one URL to index and rank, and treat it as a strong hint rather than a command.
Should a page have a canonical that points to itself?
Yes. A self-referencing canonical on every page means that a copy reached through a parameter or another host still points back to the clean URL, so ranking signals are not split across duplicates.
Should the canonical URL be absolute or relative?
Use an absolute URL with the scheme and host. Google accepts relative URLs, but an absolute one cannot be misread when the same HTML is served from a staging or alternate host.
What does EngineeringScore check?
Whether the page has a <link rel="canonical"> element. A separate check flags a canonical, share tags or sitemap that point at a different domain from the one scanned.

Related checks

Ready to see where you stand?

Scan your site and get your Engineering Score with a prioritized roadmap in under a minute, no signup required.

Scan your site

Session expired

Your session has expired for security. Please log in again to continue.