Skip to content
SeenLens

Add a canonical URL: how to fix a missing canonical tag

A canonical URL is the address you want search engines to index for a page. Your page lacks one when the head has no rel=canonical link. Add a link with the page's own absolute URL on the same host. Search engines treat it as a strong hint. The change takes about 15 minutes.

By SeenLens · Last updated

Run the free 43-check scan on your page

What this check tests

SeenLens finds the first <link rel="canonical"> in the HTML. It resolves a relative address against the final URL of the page and compares the host name with the page's host.

How the canonical check scores the page
ResultWhat SeenLens found
WarnNo canonical link
FailThe canonical is on a different host, for example www.example.com for a page on example.com
PassA canonical on the same host as the page

How to confirm the problem

curl
curl -s https://example.com/your-page | grep -i -o '<link[^>]*rel="canonical"[^>]*>'

No output means the tag is missing. The embedded scan shows the canonical it found.

How to fix it

Add one canonical link inside <head>. Use an absolute URL, the preferred version of the address, and the same value you list in your sitemap.

HTML head
<link rel="canonical" href="https://example.com/your-page" />
  • Next.js: set metadataBase in the root layout and alternates.canonical in the page metadata. Next.js prints the full link (docs updated 2026-08-19).
  • WordPress: core prints a canonical link on single posts and pages. It does not print one on every archive page. Set the canonical for the others in your SEO plugin or theme.
  • Shopify: themes print <link rel="canonical" href="{{ canonical_url }}" /> in layout/theme.liquid. Add it if your theme lacks it.
  • Non HTML files such as PDFs: send a Link: <https://example.com/file.pdf>; rel="canonical" response header. Google supports this for web search results.
Next.js
// app/layout.tsx
export const metadata = { metadataBase: new URL("https://example.com") };

// app/guide/page.tsx
export const metadata = { alternates: { canonical: "/guide" } };

What mistakes make a canonical tag fail?

Google lists these mistakes: placing the link outside <head>, using a relative path, adding hreflang, lang, media or type attributes to the canonical link, naming different canonical URLs through different methods, using a URL fragment, using robots.txt or noindex to choose a canonical, and linking to HTTP duplicates. Google says a canonical declaration is a signal, and it may pick another URL.

What does a canonical URL mean?

It is the address of the version of a page that you want search engines to index and show. Other addresses with the same content point to it.

Should every page have a canonical tag?

Google recommends a self referencing canonical on the canonical page itself.

How to verify the fix

  1. Run the curl command. It must print one canonical link with your own URL.
  2. In Google Search Console, run URL Inspection and compare the user declared canonical with the Google selected canonical.
  3. Run the SeenLens scan and confirm the canonical check passes.

Run the free SeenLens scan on your page

When can you ignore it?

A canonical on another host is correct when you republish content and want the original source to receive the credit. A page that you keep out of search with noindex does not need one. Never use noindex to choose a canonical.

Sources