Skip to main content
Wright Websites

canonical-beacon

check canonical and hreflang

Check canonical tags and hreflang clusters in your built static site: missing, multiple, relative or in-body canonicals, targets that are missing, noindex or chained, and hreflang codes.

  • 10/week on npm
  • 2★
  • MIT
  • v1.0.1
  • SEO & AEO
npx canonical-beacon

Read the full README on GitHub (opens in a new tab)View on npm (opens in a new tab)

canonical-beacon

From the README

Canonical and hreflang mistakes are silent. A template ships two canonicals, a page canonicalises to a URL that was renamed, a translated page points hreflang at an English page that never links back, or a region is written en-UK. Search engines then ignore the hints, index the wrong URL or show the wrong language. canonical-beacon reads the built HTML (plus Link headers from headers/vercel.json) and checks every canonical and hreflang annotation against the other pages in the build. Each finding has the file, line, severity and a concrete fix.

npx canonical-beacon dist
npx canonical-beacon dist --base-url https://example.com --fail-on medium
npx canonical-beacon out --clean-urls --exclude "/drafts/**"
npx canonical-beacon public --allow-cross-domain --format sarif > canonical.sarif

Related packages

SEO & AEO