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.
| Result | What SeenLens found |
|---|---|
| Warn | No canonical link |
| Fail | The canonical is on a different host, for example www.example.com for a page on example.com |
| Pass | A canonical on the same host as the page |
How to confirm the problem
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.
<link rel="canonical" href="https://example.com/your-page" />- Next.js: set
metadataBasein the root layout andalternates.canonicalin 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 }}" />inlayout/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.
// 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
- Run the curl command. It must print one canonical link with your own URL.
- In Google Search Console, run URL Inspection and compare the user declared canonical with the Google selected canonical.
- Run the SeenLens scan and confirm the canonical check passes.
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
- Google Search Central: consolidate duplicate URLs (rel=canonical rules, header form, common mistakes, checked 2026-11-06)
- Next.js: generateMetadata (alternates.canonical and metadataBase, updated 2026-08-19)
- WordPress: rel_canonical() (outputs rel=canonical for singular queries, checked 2026-11-06)
- Shopify: Add SEO metadata to your theme (canonical_url in the theme head, checked 2026-11-06)