Skip to content
Discussion options

You must be logged in to vote

Thanks to @pawelhoros's comment, I checked out the behavior of dynamic sitemaps in the newest Next.js version (14.2.3) and it seems like it is indeed possible to specify a revalidation interval in your sitemap.ts/sitemap.js file now.
You can check out my demo setup here: https://gist.github.com/fabiancdng/ef318c99d8a9f5efc2c48f6a06108881

If someone is still running into stale sitemaps despite the exported revalidate constant, I recommend upgrading to a newer Next.js version. If you don't want to (or can't) do that, I recommend the solution proposed by @viniciusbitt using route handlers.

Closing this discussion now.
Thanks to everyone who gave their input on this!

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@FerrariAndrea
Comment options

@lcnogueira
Comment options

@mdrayer
Comment options

@FerrariAndrea
Comment options

@lcnogueira
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@MartineBoulanger
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by fabiancdng
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
10 participants