next-sitemap
next-sitemap copied to clipboard
next/headers call prevent sitemap generation
Describe the bug
When headers()
(imported from next/headers) is called in a layout.js or in a page.js file, next-sitemap doesn't generate.
To Reproduce Link to the repro: https://github.com/bastienrobert/next-sitemap-generation-with-headers-repro
Steps to reproduce the behavior:
- create a new project with
pnpm create next-app
- install
next sitemap
- create a basic
next-sitemap.config.js
file - add postbuild script
- add
headers()
call (from next/headers) in layout.js - run
pnpm build
- run
pnpm postbuild
sitemap is empty
- remove
headers()
in layout.js - run
pnpm build
- run
pnpm postbuild
sitemap-0.xml is generated
Expected behavior
sitemap-0.xml
generation event if there's a headers()
call.
Closing this issue due to inactivity.
Running into this same issue with cookies()
... sitemap-0.xml
is only generated if the cookies()
call is removed.
+1
Same here when headers()
are called on a not-found.js
+1
Please don't "+1", use the Github reactions feature
Closing this issue due to inactivity.