statically generating sitemap + revalidate
Unanswered
West Highland White Terrier posted this in #help-forum
West Highland White TerrierOP
My client has a blog app with a few thousands of posts. Because of that, the server side rendered sitemap is taking too long to render. I found this page https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap in the docs and did a quick test and it works. Since this is a statically generated file, I'm querying the data from our Sanity database and the posts list is server side rendered I would like to revalidate this sitemap file every ~2 hours. Does anyone know if that's possible?
(I'm not using the nextjs fetch, but the cms client lib instead since I need to use it's own query language - it's a sanity CMS).
(I'm not using the nextjs fetch, but the cms client lib instead since I need to use it's own query language - it's a sanity CMS).
6 Replies
West Highland White TerrierOP
I'm looking for the same as https://github.com/vercel/next.js/discussions/50419
West African Crocodile
Hello @West Highland White Terrier , Nice to meet you.
This is Vector. I'm expert of Nextjs
I can help you.
This is Vector. I'm expert of Nextjs
I can help you.
West Highland White TerrierOP
Hi, @West African Crocodile
West African Crocodile
Hi. Sorry for the late reply.
Gharial
Any follow-up here? I have the same want here: revalidate sitemap.xml after build-time.
West Highland White TerrierOP
Sorry for the late response @Gharial . Not sure if you have handled this already, but in case not, I used the solution described here https://github.com/vercel/next.js/discussions/50419#discussioncomment-6189168 and it works.