Skip to content

Rule · Lint

Canonical URL set in the root layout

lint/canonical-in-root-layouterrorvoid lintupdated

Why it matters

Metadata is inherited, so a canonical in the root layout makes every page that doesn't override it declare itself a duplicate of that URL. Google then drops those pages from the index.

How to fix it

Remove alternates.canonical from the root layout and set it per page (alternates: { canonical: '/pricing' }).

Example

ts
// app/pricing/page.tsx
export const metadata = { alternates: { canonical: '/pricing' } }

References

void lint reports 67 rules in this category. Static source checks with no browser: Tailwind v4 silent failures, Next.js 16 API traps, React render-body bugs, accessibility markup, SEO files and motion hygiene.