Trigger Netlify Builds when content changes in Contentful

Khaled Garbaya
InstructorKhaled Garbaya
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 3 years ago

Netlify will automatically build your Gatsby website whenever you push new code to your repository but what about content changes in Contentful. In this lesson, you will learn how to use Contentful webhook feature to trigger a Netlify build whenever you publish or delete new content on Contentful

Instructor: [00:00] Netlify will rebuild our website whenever we push new code, but we want also to trigger the rebuild whenever we do content changes. We can do that using what's called webhooks. Let's go to deploy settings, and in build hooks, you can click add build hook. Let's call this Contentful and hit save.

[00:28] We grab this URL and go to Contentful. In there, we go into settings, webhooks, and we add webhook. This one, we'll call it Netlify. We will paste our URL in here, and we select specific events that will trigger this rebuild.

[00:53] We want that whenever we publish a new entry, a content type, or an asset. We can go to publish and check these. Also, in onPublish and onDelete. Let's hit save, and to test our webhook, we can go to the content. Go to this lesson.

[01:23] Let's change something. Let's remove this question mark, and we hit publish. Now, when we go back to Netlify, and go to deploys, you can see that here, it's triggered by Contentful. Now, it's rebuilding our website.

[01:50] When we preview this, we should see the new content reflected in the website.

egghead
egghead
~ 10 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today