Search code examples
reactjsnginxdeploymentcontentful

Deploying GatsbyJS on Nginx Digital Ocean


So, I have a GatsbyJS website done. And I need some clarification on how to proceed.

So what I want to do: Create a blog with GatsbyJS using Contentful as my CMS. Each time I add something on Contentful, my website will query data from Contentful and update in website.

So where I'm stuck: I'm unsure of how to approach the last part. I ran gatsby build and it came out with production html files which I have successfully deployed on my server and it works with the current entries on Contentful.

But, this is different from what I wanted because, I have new entries on Contentful that I wish for it to be updated on my website.

Is there a way for me to update my website each time I create a new entry on Contentful. Or must I do the build each time I create a new entry.

Thanks!


Solution

  • The solution to this is to set up web hooks. You can define these in Contentful and when some one publishes content requests will be made to a server you define.

    I'm not sure what Digital Ocean offers but when you have a CI server/service (Travis, Circle) in place, it will re-build your site with fresh data after receiving a hook. :)