next.js: Nested sitemaps seem to 404 in Next.js 15
Link to the code that reproduces this issue
https://github.com/JamesSingleton/sitemap-issue
To Reproduce
- Start the app running
pnpm dev - Go to
http://localhost:3000/resources/sitemap.xml/0since in dev mode that’s where it is supposed to live according to the docs - You will get a 404
- You can also do
pnpm build && pnpm startand then go tohttp://localhost:3000/resources/sitemap/0.xmland you will get a 404 as well.
Current vs. Expected behavior
In Next 14 this worked just fine. However, after upgrading to Next 15 this no longer works.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 10
Binaries:
Node: 20.15.0
npm: 10.7.0
Yarn: 1.22.22
pnpm: 9.13.0
Relevant Packages:
next: 15.0.4-canary.11 // Latest available version is detected (15.0.4-canary.11).
eslint-config-next: 15.0.3
react: 19.0.0-rc-66855b96-20241106
react-dom: 19.0.0-rc-66855b96-20241106
typescript: 5.6.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local), Vercel (Deployed)
Additional context
If you go to localhost:3000/sitemap.xml it will load that sitemap just fine
I even tried moving the sitemap.ts to just app/resources/sitemap.ts and going to http://localhost:3000/resources/sitemap.xml/0 still does not load anything
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 21 (8 by maintainers)
@JamesSingleton Thank you for the feedback! Will be sharing with the team. <picture data-single-emoji=":blob_bowing:" title=":blob_bowing:">
</picture>
Let me know what you find out because having dynamic sitemaps would mean things could change pretty frequently and therefore the hash would change. It’s a little concerning we are roughly a month and a half out from the v15 release and this was just now caught (probably not the right terminology). This is a major change in how users handle sitemaps, you’re basically forcing everyone to now go into their Google Search Console, Bing, etc and update the sitemaps that search engines look at because of a change Next.js made and not one they deliberately made.
Agreed, so that’s on us! That’s why we’re updating the docs now.
I think it’s more like the CSS Modules where it doesn’t change unless something else changes (in the process of figuring that out).
I’ve also been having sitemap 404 issues on https://github.com/aelew/devterms using Next.js 15.0.3. Worked fine on 14. Google hasn’t been able to read my dynamic sitemaps ever since I upgraded 🫤