AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Static Metadata Rendered In <Body> Instead Of <Head> In Next.Js 15.5.4

In Next.js 15.5.4, metadata defined via 'export const metadata' is incorrectly rendered inside <body> instead of <head>, breaking Open Graph, Twitter Cards, and SEO. Downgrading to 15.2.4 restores correct behavior.

highConfidence 75%Next.jsAffected V15.5.4

Origin Analysis

Regression in Next.js 15.5.4 likely introduced when updating React 19.2.0 support or metadata streaming logic. The metadata hoisting mechanism that should inject metadata into <head> is failing, causing the tags to remain in the component tree and be rendered in <body>. Likely an internal ordering or Suspense boundary issue in the app-render pipeline.
1. Clone https://github.com/fabiotheo/nextjs-metadata-bug 2. Run npm install and npm run dev 3. Open http://localhost:3000 and inspect HTML in DevTools 4. Observe that custom meta tags (og:title, fb:app_id, twitter:card) appear inside <body> instead of <head>

Fixing Code Block

Edge Case Audit

Manual metadata in <head> deviates from Next.js best practices and will not support dynamic metadata, image generation, or automatic canonical URLs. If you keep the export const metadata, duplicate tags may appear. After upgrading to a fixed version, remove this manual block and restore the Metadata API. Rollback to 15.2.4 is also a safe alternative.

Ecosystem Topology