Next.js Discord

Discord Forum

How to combine static page with revalidation?

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Hey guys,

I have SSG pages with ISR (revalidation) like so: /jobs/[slug] and they update only via a hook from the CMS that calls revalidateTag on every change.

This works for single job pages, but not on on my home page where I have a server component showing the last 5 jobs. Because of this, Nextjs exported the home page as dynamic, but I'd like to have the home page static as well. I didn't know how else to activate it other than to export const dynamic = 'force-static'. But now my home page is completely static and doesn't update after revalidateTag is called.

How should I achieve this? Thank you.

1 Reply

Cape lionOP
Oh 🙂 , it was right there, next to revalidateTag:

https://nextjs.org/docs/app/api-reference/functions/revalidatePath