Skip to content
Issue docs

More than one canonical tag

Importantmultiple_canonical_tagsIssue 157

What is this issue?

The page's <head> declares more than one canonical URL:

<link rel="canonical" href="https://example.com/shoes" />
<link rel="canonical" href="https://example.com/shoes?colour=red" />

A page can only have one canonical. When it declares several different ones, search engines cannot tell which you meant.

Two tags naming the same URL are not reported — they are one declaration written twice, and harmless. A canonical tag in the page body is not counted here either; search engines ignore it, and it is reported separately as "Canonical tag outside the head".

The usual cause is a theme and an SEO plugin both writing a canonical.

Why it matters

  • Google ignores all of them. Google's documentation is explicit: when a page specifies several different canonical URLs, it disregards the hints and picks a canonical itself. Your canonical has stopped doing its job.

  • Duplicates stop being consolidated. The point of a canonical is to fold parameter variants, tracking URLs and copies into one URL. With the hint ignored, those variants compete with each other and split ranking signals.

  • The tag you edit may not be the one that matters. Whoever fixes "the canonical" in one plugin leaves the other in place, and the conflict survives.

How to fix it

  1. Find both writers. View the page source and search for rel="canonical". The tags are usually emitted by two different things — a theme and an SEO plugin, a framework's head manager and a hand-written tag.

  2. Decide which URL is canonical, and switch off canonical output in the other writer (most SEO plugins and themes have a setting for it).

    <!-- Before -->
    <link rel="canonical" href="https://example.com/shoes" />
    <link rel="canonical" href="https://example.com/shoes?colour=red" />
    
    <!-- After -->
    <link rel="canonical" href="https://example.com/shoes" />
  3. Re-crawl and confirm one canonical remains.

Examples

Example 1: One canonical

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

Passes.

Example 2: The same canonical twice

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

Passes. Both resolve to the same URL. Worth tidying, not a conflict.

Example 3: Two different canonicals

<head>
  <link rel="canonical" href="https://example.com/shoes" />
  <link rel="Canonical" href="https://example.com/shoes?colour=red" />
</head>

Fails. Two targets; Google ignores both.

Example 4: A second canonical in the body

<head><link rel="canonical" href="https://example.com/shoes" /></head>
<body><link rel="canonical" href="https://example.com/boots" /></body>

Passes this check. The body tag is ignored by search engines and reported as "Canonical tag outside the head" instead.

How PixyScan detects this

  1. Every canonical link is found. <link> elements whose rel contains the token canonical, case-insensitively — so rel="Canonical" and rel="canonical nofollow" both count.

  2. Only canonicals in the head are compared. "In the head" is decided the way a search engine's HTML parser decides it: a canonical after a body-only element (a <div>, an <img>, stray text) has left the head even if the source puts it there. See "Canonical tag outside the head" (#201).

  3. Each href is resolved against the page URL, with the fragment removed. Tags with no href, or an empty one, declare nothing and are skipped.

  4. Reported when two or more different targets remain. The finding lists the distinct targets. Identical duplicates are recorded on the page data (the duplicate-elements list) but not reported.

What we store

Storage Level

Page Level


Database Table / Prisma Model

PageSeoBasicsData (page_seo_basics_data). The finding itself is stored on audit_issues.details.


Fields Used

Field Type Description
canonical_url String? The first <link rel="canonical"> href in the document, exactly as written
has_duplicate_elements Boolean? True when the page declares a canonical (or title, description, H1) more than once
duplicate_elements Json? One entry per repeated element: { element: 'canonical', value, count }

Stored Fields on the finding

Field Type Description
canonicalUrls Array The distinct canonical targets in the head, resolved
count Int How many canonical tags the whole document carries

Detection Dependencies

  • HTML Document — every <link rel="canonical"> and its position in the parsed document

Further reading