mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1055] [MERGED] fix(shims): match Next metadata merge and Twitter inheritance #1054
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#1054
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/1055
Author: @NathanDrake2406
Created: 5/4/2026
Status: ✅ Merged
Merged: 5/5/2026
Merged by: @james-elicx
Base:
main← Head:fix/metadata-merge-and-twitter-inheritance📝 Commits (4)
fe52be8fix(shims): deep-merge nested metadata and add OG/Twitter inheritanceeb8497bfixup! fix(shims): deep-merge nested metadata and add OG/Twitter inheritance1e5ad6bchore: address review feedback — clone input, ?? for title, missing test4b4869dfix(shims): match Next metadata segment replacement📊 Changes
4 files changed (+413 additions, -5 deletions)
View changed files
📝
packages/vinext/src/server/app-page-head.ts(+5 -0)📝
packages/vinext/src/shims/metadata.tsx(+146 -3)📝
tests/app-page-head.test.ts(+20 -0)📝
tests/features.test.ts(+242 -2)📄 Description
What this changes
Metadata merging now matches Next.js segment semantics while keeping the useful OpenGraph and Twitter post-processing from this branch.
Nested metadata objects such as
openGraph,twitter,icons,alternates, androbotsare replaced when a later segment defines the same key. Customothermetadata remains merged across segments, which is the explicit exception in Next's resolver.The branch also keeps the final metadata post-processing pass so Twitter metadata can inherit from OpenGraph after layouts, pages, and file-based metadata have all been resolved.
Why
The original branch treated most nested metadata objects as shallow-merge targets. That preserved stale parent fields when a child segment supplied a partial object, for example keeping a root OpenGraph image after a page defined only its own OpenGraph title.
Next documents metadata merging as shallow, and the source assigns current segment values for
openGraph,twitter,alternates,icons, androbots. Onlyotheris merged with prior metadata.Approach
othermerge guarded by the supported custom metadata value shape.openGraphobject, matching Next's post-processing flow.Validation
vp test run tests/features.test.tsvp test run tests/app-page-head.test.tsvp check tests/features.test.ts tests/app-page-head.test.ts packages/vinext/src/shims/metadata.tsxvp check --fixandknipRisks / follow-ups
No known follow-up for the reviewed issue. This intentionally does not recursively merge nested metadata fields other than the supported
othermetadata map.References
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.