Skip to content

Rule · SEO

Canonical URL is relative or contains a fragment

seo/canonical-invaliderrorvoid seoupdated

Why it matters

Google asks for absolute canonical URLs; relative ones get resolved against unexpected bases (previews, proxies) and fragments are ignored. This is a scoring gate.

How to fix it

Set metadataBase in the root layout so alternates.canonical becomes absolute, and never include #fragments.

Example

ts
// app/layout.tsx
export const metadata: Metadata = { metadataBase: new URL('https://acme.example') }

References

void seo reports 60 rules in this category. What search engines need from the raw response: status codes, titles and descriptions in <head>, self-referencing canonicals, one h1, crawlable links, Open Graph, icons, robots.txt and a sitemap with real dates.