CITELOG › CHECKS › CANONICAL

Does the canonical point to the page itself?

A canonical link tells engines which URL to cite when the same page has several addresses. Citelog checks that each page has exactly one, pointing to itself.

At a glance

Check Canonical points to itself
ID in --json output canonical
Why it matters A canonical tells engines which URL to cite when the same page has several addresses.
Weight 1 of 17 points in the 0-100 score (a warning earns 50% of them)

What does Citelog check?

It reads every <link rel="canonical"> in the page's head.

Result When
Pass One canonical, pointing to this page's URL (a trailing slash and www. don't count as differences).
Warn No canonical link.
Warn The canonical points to a different URL. That's right only if the other page is the one you want cited.
Fail Two or more different canonicals.
Fail The canonical isn't a valid URL.

When it checks a folder of built HTML, it compares paths only, since it doesn't know your domain.

How do I fix it?

  • Next.js (App Router): set alternates: { canonical: '/your-page' } in the page's metadata, with metadataBase set to your site's origin in the root layout.
  • Astro: add <link rel="canonical" href={new URL(Astro.url.pathname, Astro.site)} /> to your layout, with site set in astro.config.mjs.
  • WordPress: WordPress core and SEO plugins (Yoast, Rank Math) output a self-referencing canonical; if you see two, turn one off.
  • Single-page apps: a canonical added by JavaScript is invisible to most AI crawlers. Put it in the HTML the server sends.

Use absolute URLs (https://yoursite.com/page) and the same form everywhere: https, with or without www., with or without the trailing slash.

How do I test it?

terminal
npx citelog check https://yoursite.com/your-page
curl -s https://yoursite.com/your-page | grep -i 'rel="canonical"'

Sources