Next.js Discord

Discord Forum

Caching sitemap/[id].xml route

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Avatar
Sun bearOP
Hey y'all I have a dynamic sitemap.xml and I have to download a large file every time a new id comes in to know what chunk from the file to receive.

I'm using vercel storage is there a way to not have to download this large file every request and only download this once on build time?

14 Replies

Avatar
Sun bearOP
tagging in my long lost friend @Jboncz
Avatar
Will take a look after work. I think you could do this pretty easily.
Avatar
Sun bearOP
❤️
Avatar
So give me some mock code of how you generaling your sitemap
When you say when a new id comes in, do you mean somethings hitting an endpoint or what?
Avatar
Sun bearOP
yeah something hitting the endpoint
@Jboncz
like ideally I'd like all these pages generated at build time
maybe it's just generateStaticParams
Avatar
That isnt a thing in appRouter I think?
Avatar
Sun bearOP
might not be haha
claude says its available in app router
Avatar
Sun bearOP
how are you doing?
Avatar
Sun bearOP
export const dynamic = 'force-static'
export const revalidate = false

btw generateStaticParams and these vars worked.