vercel / vercel/next.js

Sitemap generation does not follow file location specification

Open
#76,835 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Metadata Route Handlers
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/dretsa/next-sitemap-spec

To Reproduce
  1. Generate multiple sitemaps as per documentation
  2. Check paths generated and see they do not follow the specification

Example - /app/product/sitemap.ts generates - from docs example:

  • /product/sitemap/0.xml
  • /product/sitemap/1.xml
  • /product/sitemap/2.xml
  • /product/sitemap/3.xml

According to the specification, these sitemaps can only contain links starting with /product/sitemap/....., as specified in the "Sitemap file location" section.

Image

Current vs. Expected behavior

I expect the generated sitemaps in a route app/product/sitemap.ts to allow me link /product/... pages. Currently they can only provide URLs starting with /product/sitemap/...

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 22.2.0
  npm: 10.7.0
  Yarn: 4.6.0
  pnpm: N/A
Relevant Packages:
  next: 15.1.7
  eslint-config-next: 15.1.7
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: standalone
Which area(s) are affected? (Select all that apply)

Metadata, Route Handlers

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

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

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked next-sitemap-spec reproduction and the app/product/sitemap.ts example, then compare the generated paths with the Sitemap file location specification in the linked Next.js documentation. Trace the metadata sitemap generation behavior involved in multiple sitemaps. Done means generated URLs can reference /product/... pages while remaining valid under the specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.