next-sitemap icon indicating copy to clipboard operation
next-sitemap copied to clipboard

next/headers call prevent sitemap generation

Open bastienrobert opened this issue 1 year ago • 7 comments

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.

bastienrobert avatar Aug 08 '23 10:08 bastienrobert

Closing this issue due to inactivity.

github-actions[bot] avatar Oct 08 '23 04:10 github-actions[bot]

Running into this same issue with cookies()... sitemap-0.xml is only generated if the cookies() call is removed.

TheCatLady avatar Oct 12 '23 10:10 TheCatLady

+1

pranavks avatar Dec 07 '23 13:12 pranavks

Same here when headers() are called on a not-found.js

LouisCuvelierStadion avatar Dec 19 '23 10:12 LouisCuvelierStadion

+1

AlexanderBich avatar Dec 25 '23 12:12 AlexanderBich

Please don't "+1", use the Github reactions feature

bastienrobert avatar Dec 25 '23 12:12 bastienrobert

Closing this issue due to inactivity.

github-actions[bot] avatar Feb 24 '24 04:02 github-actions[bot]