Canonical URLs and Duplicate Content

The same page reachable at seven URLs is seven competing pages to a search engine. One line of markup consolidates them.

Concept

Search engines treat a URL as a page. If the same content is reachable at several URLs, that is several pages with identical content - and the signals that would make one page rank are split across all of them.

This happens far more often than people expect, and almost always by accident.

How duplicates appear

https://example.edu/courses/design
https://example.edu/courses/design/
http://example.edu/courses/design
https://www.example.edu/courses/design
https://example.edu/courses/design?utm_source=newsletter
https://example.edu/courses/design?ref=facebook
https://example.edu/Courses/Design
https://example.edu/courses/design/index.html

Eight URLs, one page. Add campaign parameters, session ids, sort orders and pagination and a medium sized shop can generate thousands.

<link rel="canonical" href="https://example.edu/courses/design">

It says: of all the URLs showing this content, index this one. Every duplicate carries the same tag, pointing at the same target, and the signals consolidate onto that one URL.

Rules

  • Absolute URL. A relative one is a common and silent failure.
  • Self referencing. The canonical page should point at itself. It removes ambiguity and handles parameters added later.
  • One per page. Two canonical tags are treated as none.
  • A hint, not a command. Google may ignore a canonical that points at clearly different content.
  • Consistent with everything else - the sitemap, internal links and redirects should all agree.
<!-- fails silently -->
<link rel="canonical" href="/courses/design">

<!-- correct -->
<link rel="canonical" href="https://example.edu/courses/design">

Canonical or redirect?

SituationUse
The URL has changed for good301 redirect
The old URL should stop working301 redirect
Both URLs must keep workingCanonical
Tracking parameters on a shared URLCanonical
A printer friendly versionCanonical
Content syndicated on another domainCross domain canonical

A redirect is stronger: it removes the duplicate entirely. Use it whenever the alternative URL does not need to keep working.

The cases that come up

Campaign parameters

<!-- on /courses/design?utm_source=newsletter -->
<link rel="canonical" href="https://example.edu/courses/design">

Tracking parameters must not create index entries. A self referencing canonical on the clean URL handles it automatically.

Pagination

<!-- on page 2, canonical points at page 2, not page 1 -->
<link rel="canonical" href="https://example.edu/journal?page=2">

Pointing every paginated page at page one is a common error. Pages two onwards then never get indexed, and the articles listed only on them are harder to discover. Each page is its own page.

Filtered and sorted listings

<!-- on /products?colour=brass&sort=price -->
<link rel="canonical" href="https://example.edu/products">

Filter combinations can produce an effectively unlimited number of URLs. Canonicalise them to the unfiltered listing, and consider blocking the parameter paths in robots.txt as well to save crawl budget.

Syndicated content

<!-- on the republished copy -->
<link rel="canonical" href="https://original.example/articles/bus-timetable">

The correct way to publish an article in two places without competing with yourself.

Language versions

<link rel="canonical" href="https://example.edu/hi/courses/design">
<link rel="alternate" hreflang="en" href="https://example.edu/courses/design">
<link rel="alternate" hreflang="hi" href="https://example.edu/hi/courses/design">
<link rel="alternate" hreflang="x-default" href="https://example.edu/courses/design">

Different languages are not duplicates. Each version canonicalises to itself, and hreflang links them. The set must be reciprocal: every version lists every other version including itself, or the whole group is ignored.

Preventing duplicates in the first place

Pick one host and redirect

http://example.edu/*        -> https://example.edu/*
https://www.example.edu/*   -> https://example.edu/*

Pick one trailing slash convention and redirect

/courses/design/   -> /courses/design

Keep URLs lower case

Most servers treat /Courses and /courses as different. Redirect uppercase variants.

Do not serve index.html directly

/about/index.html  -> /about/

Diagnosing it

In Search Console, URL Inspection reports the Google selected canonical alongside the one you declared. When they differ, Google has overruled you - usually because internal links, the sitemap or redirects point somewhere else.

The Pages report lists exclusion reasons including Duplicate without user selected canonical and Alternate page with proper canonical tag. The first is a problem; the second is the system working.

Important rules

  • Canonical URLs must be absolute.
  • Every page should have a self referencing canonical.
  • One canonical per page.
  • Redirects are stronger than canonicals.
  • Language versions are not duplicates.
  • hreflang sets must be reciprocal.
  • Canonical, sitemap and internal links must agree.

Common mistakes

  • Relative canonical URLs.
  • Every page canonicalising to the home page, which deindexes the site.
  • Paginated pages all pointing at page one.
  • Canonical pointing at a redirecting or non existent URL.
  • Two canonical tags, one from a template and one from a plugin.
  • No redirect between the www and non www forms.
  • Canonicalising language versions to each other.

Best practices

  • Self referencing absolute canonical on every page, generated by the template.
  • Redirect to one host form and one trailing slash convention at the server.
  • Keep sitemap URLs identical to the canonical URLs.
  • Link internally to canonical URLs, never to redirecting ones.
  • Give each paginated page its own canonical.
  • Check the Google selected canonical after launch.

Practice

  1. List every URL form that reaches your home page. How many are there?
  2. Add a self referencing canonical to a template and verify it renders as an absolute URL.
  3. Explain why canonicalising page two of a listing to page one is harmful.
  4. Use URL Inspection to compare your declared canonical with the one Google selected.

Useful resources

Hand picked references for this topic
Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Continue reading

All HTML notes →

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.