[GH-ISSUE #397] Feature Request: Support for generateSitemaps() #86

Closed
opened 2026-05-06 12:37:07 +02:00 by BreizhHardware · 0 comments

Originally created by @tlmader on GitHub (Mar 10, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/397

Description

vinext currently supports basic sitemap.ts metadata file routes (single <urlset> per route segment), but does not support Next.js's generateSitemaps() API for
paginated sitemaps.

Current Behavior

  • sitemap.ts default export is called with no arguments (await metaFn())
  • Each sitemap.ts maps to a single fixed URL (e.g., /photos/sitemap.xml)
  • sitemapToXml() only produces <urlset> — no <sitemapindex> serialization exists
  • The generateSitemaps() named export is ignored if present

Expected Behavior

Per the Next.js API:

  1. If a sitemap.ts exports generateSitemaps(), call it to get a list of { id } objects
  2. For each id, serve the sitemap at /{segment}/sitemap/{id}.xml by calling sitemap({ id })
  3. Serve a <sitemapindex> at /{segment}/sitemap.xml listing all paginated sitemap URLs — this requires a new serializer alongside sitemapToXml() that produces <sitemapindex> with <sitemap><loc> entries

This is required for collections that exceed the 50,000 URL limit per sitemap file (per the sitemaps protocol).

Originally created by @tlmader on GitHub (Mar 10, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/397 ### Description vinext currently supports basic `sitemap.ts` metadata file routes (single `<urlset>` per route segment), but does not support Next.js's [`generateSitemaps()`](https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps) API for paginated sitemaps. ### Current Behavior - `sitemap.ts` default export is called with **no arguments** (`await metaFn()`) - Each `sitemap.ts` maps to a single fixed URL (e.g., `/photos/sitemap.xml`) - `sitemapToXml()` only produces `<urlset>` — no `<sitemapindex>` serialization exists - The `generateSitemaps()` named export is ignored if present ### Expected Behavior Per the [Next.js API](https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps): 1. If a `sitemap.ts` exports `generateSitemaps()`, call it to get a list of `{ id }` objects 2. For each `id`, serve the sitemap at `/{segment}/sitemap/{id}.xml` by calling `sitemap({ id })` 3. Serve a `<sitemapindex>` at `/{segment}/sitemap.xml` listing all paginated sitemap URLs — this requires a new serializer alongside `sitemapToXml()` that produces `<sitemapindex>` with `<sitemap><loc>` entries This is required for collections that exceed the 50,000 URL limit per sitemap file (per the [sitemaps protocol](https://www.sitemaps.org/protocol.html)).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#86
No description provided.