Skip to content

Rule · Lint

Root layout metadata has no metadataBase

lint/missing-metadata-baseerrorvoid lintupdated

Why it matters

Relative URLs in openGraph.images, alternates.canonical and file-based opengraph-image resolve against metadataBase. Without it Next falls back to localhost/VERCEL_URL, so previews and canonicals point to the wrong host.

How to fix it

Set metadataBase: new URL(site.url) in the root layout, with the production origin.

Example

ts
export const metadata: Metadata = {
  metadataBase: new URL('https://example.com'),
  title: { default: 'Acme', template: '%s — Acme' },
}

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.