Skip to content
Discussion options

You must be logged in to vote

According to the docs, https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap:

sitemap.js is a special Route Handlers that is cached by default unless it uses a dynamic function or dynamic config option.

So you should be able to export one of these, https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config, such as revalidate, to have it regenerate at runtime.

Alternatively, as the docs say, a sitemap file is a special Route Handler, so you could just make a Router Handler, that returns XML, and revalidates every now and then. #52831 - though that shouldn't be necessary.

I'll run a couple of local tests with revalidate to see it if works, but i…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@joonarafael
Comment options

@icyJoseph
Comment options

@gmoniava
Comment options

Answer selected by joonarafael
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants