Static generation build question
Answered
Schneider’s Smooth-fronted Caima… posted this in #help-forum
Schneider’s Smooth-fronted CaimanOP
I have a bunch of statically generated pages in my app that are populated with content pulled from a CMS. To get the content of these pages to reflect the latest content in the CMS I have to deploy a new commit. I was hoping I could do this programatically and found a way to do so, the only issue is that if I try to deploy the latest commit (either via API https://vercel.com/docs/rest-api/endpoints/deployments#create-a-new-deployment or by Vercel UI) it doesn't seem to get the latest from the CMS when building static files. I have to perform a fresh dummy commit if i want to see my static files have the correct content.
Is there any option somewhere that I am missing which forces a reployment of a previous hash to be a fresh build entirely?
Is there any option somewhere that I am missing which forces a reployment of a previous hash to be a fresh build entirely?
Answered by Schneider’s Smooth-fronted Caiman
ah i see you can revalidate dynamic paths
revalidatePath('/blog/[slug]', 'page')6 Replies
Schneider’s Smooth-fronted CaimanOP
Seems having
export const revalidate = 60; at the top of my SSG pages solves the issue with content being updated. No need to rebuild/deploy the whole site 🙂@Schneider’s Smooth-fronted Caiman Seems having `export const revalidate = 60;` at the top of my SSG pages solves the issue with content being updated. No need to rebuild/deploy the whole site 🙂
yup. or just make a route handler where it calls
then whenever the content is updated in the cms, send a request to that route handler (webhook)
revalidatePath to revalidate your pagethen whenever the content is updated in the cms, send a request to that route handler (webhook)
@joulev yup. or just make a route handler where it calls `revalidatePath` to revalidate your page
then whenever the content is updated in the cms, send a request to that route handler (webhook)
Schneider’s Smooth-fronted CaimanOP
Great idea thanks
Schneider’s Smooth-fronted CaimanOP
all the routes i need revalidate are at
i dont use fetch, i use prisma client, and it seems that tag is an option of fetch
if i use revalidatePath, what path would it be?
/[slug] i dont use fetch, i use prisma client, and it seems that tag is an option of fetch
if i use revalidatePath, what path would it be?
Schneider’s Smooth-fronted CaimanOP
ah i see you can revalidate dynamic paths
revalidatePath('/blog/[slug]', 'page')Answer
yup