More than one canonical tag
What it is
The page’s HTML contains two or more <link rel="canonical"> tags. When they name different pages, the page gives search engines contradictory instructions. When they name the same page, the copies are redundant, and usually a sign that two parts of the site, such as a theme and an SEO plugin, each add their own tag.
Why it matters
Google says that when a page carries several canonicals pointing to different URLs , it will likely ignore all of them. The preference you set is then likely lost and Google picks the main URL on its own, as if the page had no canonical. Identical copies have no documented cost, but two systems are writing the tag, and the next change to either one can turn the copies into a conflict.
How Asky checks it
Asky counts every <link rel="canonical"> with a non-empty href in the page’s raw HTML, in the head and the body; tags added by JavaScript and a canonical in an HTTP Link header are not counted. With two or more, it resolves each href against the page URL and drops any # fragment and a final slash, so /pricing and https://example.com/pricing/ name the same page, while another protocol, host or query string names a different one. Tags naming different pages are reported as an error with high severity; tags naming one page as a warning with medium severity. The relative, fragment and canonicalised checks read the first tag only.
How to fix it
- Open the page source (the raw HTML, not the browser’s element inspector) and search for
canonicalto find every copy. - Work out what writes each one: the theme or template, an SEO plugin, the CMS’s own SEO field, or a custom code block in the head or body.
- Keep one source, usually the SEO plugin or the CMS’s built-in SEO setting, and switch off or delete the others. In WordPress, a theme that adds its own canonical next to an SEO plugin is a common cause.
- Point the remaining tag at the URL you want indexed, normally the page itself, as a full
https://address without a#part. - Make sure the tag that remains sits in the
<head>: a canonical left only in the body is reported as outside the head.
Example
https://example.com/blog/pricing-guide gets one canonical from an SEO plugin and one from its theme, which builds it with the www host. Two hosts name two different pages, so the tags conflict:
<!-- Before: two tags, two pages -->
<link rel="canonical" href="https://example.com/blog/pricing-guide">
<link rel="canonical" href="https://www.example.com/blog/pricing-guide">
<!-- After: the theme's tag is switched off -->
<link rel="canonical" href="https://example.com/blog/pricing-guide">