nextjs - 💡(How to fix) Fix App Router - `generateMetadata` - unfurling does not work in Slack #83926 [4 comments, 2 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#83928Fetched 2026-04-08 02:21:08
View on GitHub
Comments
4
Participants
2
Timeline
7
Reactions
0
Timeline (top)
commented ×4issue_type_added ×1mentioned ×1subscribed ×1

Code Example

This is unrelated to operating system or build environment
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/FLock-io/FLock-AI-Demo/blob/a10b74286fdfdd2ee0e36af3dd746e50b80f1d86/FLOCK-RAG-FRAME-Nextjs/app/page.tsx#L14-L17

To Reproduce

Use the generateMetadata function to set openGraph tags (like <meta property="og:image" />)

On larger apps, the produced <meta ...> tags are too far down in the HTML for Slack's unfurl logic to find it, which causes Slack to ignore them, refuse to unfurl links when it sees URLs to NextJS pages.

When unfurling, Slack places a 32kb Range HTTP Header, documented in this blog post: https://blog.daveallie.com/slack-link-unfurling/#why-slack-why

In practice, that is still how Slack unfurls URLs, and due to this Range limit, the generated <script ... /> and other tags in the <head> above the <meta ...> tags can cause them to be to be past 32KB in the HTML source code of our website pages. Slack then refuses to unfurl any links to the page

Current vs. Expected behavior

I would expect that unfurling in Slack continues to work regardless of how the pages are chunked or other tags in the <head>, by placing the <meta> tags related to OpenGraph, as closes to the top of the <head> as possible

Provide environment information

This is unrelated to operating system or build environment

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

Not sure

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

Vercel (Deployed), Other (Deployed)

Additional context

No response

extent analysis

TL;DR

Move the OpenGraph <meta> tags to the top of the <head> section in the HTML to ensure they are within the 32KB range for Slack's unfurl logic.

Guidance

  • Review the generateMetadata function in app/page.tsx to understand how the OpenGraph tags are being generated and inserted into the HTML.
  • Modify the generateMetadata function to prioritize the placement of OpenGraph <meta> tags at the top of the <head> section.
  • Verify that the modified function correctly places the OpenGraph tags within the 32KB range by inspecting the HTML source code of the generated pages.
  • Test the changes by sharing a link to a page on Slack and checking if the link unfurls correctly.

Example

No specific code example can be provided without modifying the original code, but the goal is to ensure that the OpenGraph tags are placed as close to the top of the <head> as possible, like so:

<head>
  {/* OpenGraph tags */}
  <meta property="og:image" />
  {/* Other head tags */}
</head>

Notes

This solution assumes that the issue is solely due to the placement of the OpenGraph tags in the HTML. If the problem persists after making these changes, further investigation into the generateMetadata function and the HTML generation process may be necessary.

Recommendation

Apply workaround: Modify the generateMetadata function to prioritize the placement of OpenGraph <meta> tags at the top of the <head> section, as this should resolve the issue with Slack's unfurl logic.

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