mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #399] [MERGED] feat: support generateSitemaps() for paginated sitemaps #542
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#542
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/399
Author: @NathanDrake2406
Created: 3/10/2026
Status: ✅ Merged
Merged: 3/10/2026
Merged by: @james-elicx
Base:
main← Head:feat/generate-sitemaps📝 Commits (5)
c4c905btest: add products/sitemap.ts fixture with generateSitemaps9fba6dffeat: support generateSitemaps() for paginated sitemaps0db02eatest: add integration tests for generateSitemaps and update snapshots80b4ba0fix: address Codex review — typed id and single-segment matchinga470457fix: address ask-bonk review feedback📊 Changes
5 files changed (+283 additions, -3 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+28 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+168 -0)📝
tests/app-router.test.ts(+60 -0)➕
tests/fixtures/app-basic/app/products/sitemap.ts(+22 -0)📝
tests/shims.test.ts(+5 -3)📄 Description
Summary
generateSitemaps()API for paginated sitemapssitemap.tsexportsgenerateSitemaps(), individual sitemaps are served at/{segment}/sitemap/{id}.xml/{segment}/sitemap.xml) is no longer served whengenerateSitemapsexists (matches Next.js behavior)generateSitemaps()resultHow it works
The runtime metadata route handler in the generated RSC entry now checks if a sitemap module exports
generateSitemaps. If so:servedUrl(e.g./products/sitemap.xml), it matches the pattern/{prefix}/sitemap/{id}.xmlgenerateSitemaps()and checks the requested ID exists in the returned array{ id: rawId }and serializes withsitemapToXml()Each paginated sitemap is a standalone
<urlset>document. Next.js does not generate a<sitemapindex>— the issue description was incorrect about that part.Note on the issue: #397 requested
<sitemapindex>support, but Next.js doesn't implement that. Users who want a sitemap index can create a separate rootsitemap.tsthat manually lists the child sitemap URLs.Closes #397
Test plan
GET /products/sitemap/0.xml→ 200, XML with batch-0 entries onlyGET /products/sitemap/1.xml→ 200, XML with batch-1 entries onlyGET /products/sitemap/99.xml→ 404 (invalid ID)GET /products/sitemap.xml→ 404 (base URL not served with generateSitemaps)scanMetadataFilesdiscovers nestedproducts/sitemap.ts/sitemap.xmlwithout generateSitemaps)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.