SEO
seo/canonical-valid
A page has at most one rel="canonical", in the head, with an absolute URL of an indexable page and no fragment.
moderatestaticfe-seo-metadata
Why
The canonical tells search engines which of several URLs with the same content to show (with and without parameters, trailing slash, www). Two canonicals, a relative path resolved against the wrong base, or a fragment make search engines ignore the hint and pick one themselves.
Fix
Emit one <link rel="canonical" href="https://example.com/path"> per page from the layout, built from the site's configured origin and the clean path (no tracking parameters, no #). Point it at a page that returns 200 and is not noindex. Keep sitemap URLs equal to canonical URLs.
Examples
<!-- bad -->
<link rel="canonical" href="/pricing">
<!-- good -->
<link rel="canonical" href="https://example.com/pricing">Sources
Facts
- Id
seo/canonical-valid- Severity
- moderate
- Check
- static checked in the source by
audit - Applies to
htmlvuesvelteastrojsx- Same problem in
- Lighthouse
canonical - Taught by the skill
fe-seo-metadataSEO and metadata- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain seo/canonical-valid