DEV Community

Discussion on: Using WordPress as a headless CMS with Next.js

Collapse
 
imakethesites profile image
Mark Wlodawski

Have you solved this yet? I need to publish more posts without touching my Next app.

Collapse
 
spencersmb profile image
spencer

I've only read that you can have wordpress fire a webhook that will tell Next.js to rebuild when you publish a new post. I read that from a post that was about a year old, so maybe there is a newer more streamlined way.

Thread Thread
 
imakethesites profile image
Mark Wlodawski

Dang, this might've been important to make note of in the article. Clearly I'm not an active blogger, as I built and published my blog a couple of months ago and I'm just now getting around to asking this, but I guess it's a learning experience.

Thread Thread
 
spencersmb profile image
spencer • Edited

Yea after reading @AndrewRoss comment below, It sounds like the future proof solution to git/webhooks. I would have a look through that.

Thread Thread
 
imakethesites profile image
Mark Wlodawski

Thanks, I'll check it out.

Thread Thread
 
logantai24 profile image
Logan Tai

If you are hosting your NextJS site in vercel/netlify, the incremental static generation feature should be able to facilitate your needs as the page will be built again in the background when a new request comes in, you only need to add a simple " revalidate: 1" in your getStaticProps function

nextjs.org/docs/basic-features/dat...

Thread Thread
 
imakethesites profile image
Mark Wlodawski

I am hosting on netlify, and I've been hoping there would be a faster solution than adding Apollo. I'll check this out, thanks.

Thread Thread
 
imakethesites profile image
Mark Wlodawski

@logantai24 Thanks, it worked!