N
Nuxt9mo ago

rendering headless cms content on nuxt ssg site

Hi, can someone please explain to me what is the best practice when rendering content from headless cms on my ssg nuxt app? Currently I am dynamically rendering (per request) all the blog posts in blog section as well as when you enter them via API calls. I am guessing that this isn't very efficient proccess because of a lot of unnecessary API calls to headless cms. My question is: Wouldn't it be better to just generate a new ssg version every time a new post is published? If so how may I implement it with nuxt + sanity (I am also using vercel for hosting). I know that there are options like netlify cms which (if im not mistaken) do that out of the box but I am not sure how may I do it with my stack.
2 Replies
CentyPoo
CentyPoo9mo ago
https://nuxt.com/docs/guide/concepts/rendering#route-rules I believe you're looking for ISR (incremental static regeneration) - there's also a vercel example in the link above. Failing that, you can always just set "blog/*" to swr: true to generate the posts on demand once
Nuxt
Rendering Modes · Nuxt Concepts
Learn about the different rendering modes available in Nuxt.
᲼
OP9mo ago
I see, yea ISR is exactly what I was looking for! tysm!
Want results from more Discord servers?
Add your server