I still need to write an article about hosting my portfolio. It is hosted for free. That article is coming, I promise!
But, in the meantime, I was so blown away with how easy it is to automatically deploy a static website in Netlify + Strapi that I had to share.
Netlify offers a feature called "Build hooks".
These are unique URLs that you can configure for your application to trigger deployments automatically whenever a post request is made to that endpoint.
And with Strapi, build hooks are incredibly easy to integrate.
First, go to the Netlify Deployment Settings in your project, and find the area for Build hooks.
There, you will have an option to create a new build hook. Give it a memorable name, and click save.
Then, copy the URL that is configured for that build hook.
Once that is done, You will want to add the build hook as a webhook in the Strapi Admin panel.
You can do this by going to "Settings > Webhooks" within Strapi.
Once you are in the Webhooks panel, add a new webhook for the URL that you just configured in Netlify.
Paste the URL that you copied from Netlify into the URL field, give the webhook a memorable name, and choose the appropriate settings for when you want to publish your changes automatically!
Isn't that cool?
Once you save your changes, go ahead and try updating some content on your site and see the wonder!
Top comments (5)
Hi there, nice post!
By the way, I still learning about Jamstack and get confused with how it should work. Is it necessary to put the strapi app on a hosting? Or just running it on a localhost with that hook will be enough? I'm trying to get full static.
Running it locally should work just fine too!
hi, is it just add the webhook url of netlify? what about the headers? . It doesn't work for me, it doesn't update immediately when adding in strapi cms :(
Hey there, I'm facing the same problem. Did you find a solution for it?
hi, it's great that you sharing all the processes.