Lighthouse audit canonical · SEO

Document does not have a valid rel=canonical: how to fix it

View raw .md for LLMs / your notes
Quick answer: Lighthouse flags a non-canonical URL when the rel=canonical link is missing, relative, or points to a redirect. Fix the canonical missing error by adding one self-referential, absolute https rel=canonical per page that returns 200. It consolidates duplicate-URL ranking signals onto your preferred URL.

Lighthouse fails this audit when your page is missing a <link rel="canonical">, or has one that is malformed, relative, points to a redirect, or conflicts with other signals. The canonical tag tells Google which URL is the authoritative version of a page when several URLs serve similar content.

TL;DR

What does the rel=canonical audit check?

Lighthouse verifies that the page has at most one rel=canonical link, that it is a valid absolute URL, and that it is not obviously broken (empty, relative-only, or pointing at a non-indexable target). It does not judge whether the chosen canonical is strategically correct. That part is on you.

What is a "non-canonical URL"?

"Non-canonical URL" is how Lighthouse and other SEO tools (Bing Webmaster Tools, Screaming Frog, Ahrefs) phrase the same problem the canonical audit catches: your page has no valid <link rel="canonical">, or the tag is relative, empty, or points at a URL that does not actually serve the page (a redirect, a 404, or a noindex target). Tools also call this "missing canonical tag", "canonical missing", "canonical is missing", or "no canonical link tag found on your homepage", all the same underlying issue.

The fix is identical to passing Lighthouse's canonical audit: add one self-referential, absolute https rel=canonical per page that returns 200. Without it, Google may index a parameter-laden or duplicate version of your URL instead of the one you want to rank.

Why does the canonical tag matter for SEO?

Most sites serve the same content under several URLs without realizing it:

Google treats each as a separate URL. Ranking signals (links, engagement) get split across them, and Google may index a parameter-laden variant instead of your clean URL. A correct canonical consolidates all of that into one page.

How do I add a valid canonical tag?

Add a self-referential canonical to <head>:

<head>
  <link rel="canonical" href="https://example.com/audits/canonical-tag" />
</head>

Rules that make a canonical valid and effective:

What are common canonical mistakes?

How do I fix canonical issues?

"Canonical issues", "canonical issue", or "canonical error" is how site auditors like Semrush, Ahrefs, Sitebulb, and Screaming Frog label the whole family of problems the Lighthouse canonical audit catches. Whatever the tool calls it, the fix is the same short checklist:

  1. No canonical at all · add one self-referential, absolute https canonical to <head>.
  2. Canonical points to a redirect or 404 · point it at the final URL that returns 200.
  3. More than one canonical tag · keep exactly one; conflicting tags make Google ignore all of them.
  4. Canonical disagrees with the sitemap or internal links · pick one preferred URL and use it everywhere.
  5. Conflicting hreflang and rel=canonical · every language variant must canonicalize to itself, not to another language's URL. A page that declares hreflang alternates while its canonical points elsewhere sends Google contradictory signals; see the hreflang audit for the full return-link rules.

Re-run Lighthouse or your site auditor after each change. If the canonical error persists, check whether a plugin or framework is injecting a second tag over the one you added.

How do I set the canonical in Next.js, WordPress, or Astro?

Next.js (App Router)

export const metadata = {
  alternates: { canonical: 'https://example.com/audits/canonical-tag' },
};

Next.js (Pages Router)

import Head from 'next/head';

<Head>
  <link rel="canonical" href={`https://example.com${router.asPath.split('?')[0]}`} />
</Head>

WordPress

Yoast SEO and Rank Math emit a self-referential canonical automatically. Do not also hardcode one in the theme: two tags conflict. Override per-page only for genuine duplicates.

Astro

---
const canonical = new URL(Astro.url.pathname, Astro.site).href;
---
<link rel="canonical" href={canonical} />

How do I verify the canonical is valid?

  1. Re-run Lighthouse: the audit should pass.
  2. View source (Cmd+U) and confirm exactly one rel="canonical" with an absolute https URL.
  3. Open the canonical URL directly: it must return 200, not redirect.
  4. Google Search Console → URL Inspection → check "User-declared canonical" matches "Google-selected canonical".

Related audits


Audit your URL at https://lighthouse-md.com.

Audit your page now

Paste your URL, get scores plus a CLAUDE.md plan for Claude Code.

Run audit →