nextjs - 💡(How to fix) Fix Using generateMetadata() renders meta tags in HTML body instead of head [7 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#83871Fetched 2026-04-08 02:21:15
View on GitHub
Comments
7
Participants
4
Timeline
18
Reactions
0
Timeline (top)
commented ×7subscribed ×4mentioned ×2closed ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:48:46 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.18.0
  npm: 10.9.3
  Yarn: 1.22.19
  pnpm: 10.10.0
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: N/A
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/scott82anderson/next-generate-metadata

To Reproduce

  1. Clone the provided example repo
  2. npm install
  3. npm run dev
  4. View http://localhost:3000
  5. View HTML source

Current vs. Expected behavior

Current Meta tags are rendered in the HTML body.

Expected Meta tags are rendered in the HTML head.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:48:46 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.18.0
  npm: 10.9.3
  Yarn: 1.22.19
  pnpm: 10.10.0
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: N/A
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context

The problem has been observed in version 15.5.3. Testing earlier versions the same bug exists in any version from 15.2 onwards. The bug is NOT present in version 15.1.8.

extent analysis

TL;DR

The issue with meta tags being rendered in the HTML body instead of the head can be addressed by investigating the Next.js configuration and the code that generates the meta tags.

Guidance

  • Review the next-generate-metadata code to ensure that meta tags are being generated correctly and appended to the HTML head.
  • Verify that the next version 15.5.3 is correctly configured and that there are no overrides or custom configurations that could be causing the issue.
  • Test the code with an earlier version of next, such as 15.1.8, to confirm that the issue is indeed related to the version change.
  • Check the HTML source to see if there are any other elements or scripts that could be interfering with the meta tags' placement.

Example

No specific code example can be provided without further information about the next-generate-metadata code.

Notes

The issue seems to be related to a change in the next version, as it is not present in version 15.1.8 but appears in versions from 15.2 onwards.

Recommendation

Apply a workaround by modifying the code that generates the meta tags to ensure they are correctly appended to the HTML head, as the issue is likely related to a change in the next version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING