I am using Next.js App Router (app/) with dynamic routes and generating metadata based on API responses.
However, my metadata does NOT appear in the SSR <head> when I check “View Page Source”.
Instead, metadata is either missing, or appears inside the <body> after hydration.
Project Context
- Route:
/app/(propertyPages)/(SeoPages)/[...slugs]/page.tsx - Metadata is generated using
generateMetadata() - Metadata depends on API calls (example:
getPageBySlugOne,validateSlugsOne, etc.) - I am using:
export const revalidate = 86400; // ISR 24hexport const dynamicParams = true; // Enable on-demand generation- API functions run inside
generateMetadata()
The Problem
Even though metadata is returned correctly from generateMetadata, it does not show inside <head> in SSR HTML.
What I actually see in “View Page Source”:
- Only global metadata from
layout.tsx - NO title
- NO meta description
- NOTHING from
generateMetadata()
Instead, Next.js injects metadata after hydration inside the <body>
This is the HTML output I uploaded:
(uploaded exact file here: random.txt)
All metadata is missing from <head> in the raw server HTML.