👀 See Sanity in action: Watch product demo now →

Add a Webhook to fix Generator Issues

6 replies
Last updated: Aug 3, 2020
I'm having issues with both Sanity's Eleventy generator as well as their Gridsome generator. New published posts added to Studio are not being displayed on the front end. I thought maybe the problem was me. So, I tried Sanity's Nuxt generator, and that works as advertised. Has anyone had the same experience?
Aug 3, 2020, 2:37 PM
BTW, my local environment doesn't have this issue. I can see all my updated posts locally. But, none of this helps me if I can't see these posts/changes on my remote site. And then I thought maybe the issue was with Netlify. But, all I see is 2 deploy builds since 2 days ago regarding template changes, not content changes.
Aug 3, 2020, 3:04 PM
Hi Scott, whether your front-end deploys automatically on content changes in Sanity depends on if you have a webhook set up for this.
For more information on webhooks:
https://www.sanity.io/docs/webhooks
To set up a webhook, enter your project on
manage.sanity.io and go to Settings > API > Webhooks > Add new webhook. If you point this to a Netlify build endpoint (or a custom function if you prefer), it should automatically trigger builds.
Bear in mind that this can easily use up your build minutes on Netlify if you publish content frequently. As an alternative, you might want to consider manually triggering a deploy hook instead whenever you finish editing and want to publish changes to your front-end. There is a Netlify widget for the Studio that allows you to do just that from the Dashboard:
https://www.npmjs.com/package/sanity-plugin-dashboard-widget-netlify 🙂
Aug 3, 2020, 3:34 PM
Hi Scott, whether your front-end deploys automatically on content changes in Sanity depends on if you have a webhook set up for this.
For more information on webhooks:
https://www.sanity.io/docs/webhooks
To set up a webhook, enter your project on
manage.sanity.io and go to Settings > API > Webhooks > Add new webhook. If you point this to a Netlify build endpoint (or a custom function if you prefer), it should automatically trigger builds.
Bear in mind that this can easily use up your build minutes on Netlify if you publish content frequently. As an alternative, you might want to consider manually triggering a deploy hook instead whenever you finish editing and want to publish changes to your front-end. There is a Netlify widget for the Studio that allows you to do just that from the Dashboard:
https://www.npmjs.com/package/sanity-plugin-dashboard-widget-netlify 🙂
Aug 3, 2020, 3:34 PM
Thanks
user M
I see that explanation now. Plus, that explains why my Netlify dashboard widget in Studio is broken. It probably needs to be configured yet.
Aug 3, 2020, 3:53 PM
Sorry about that Scott, it’s an issue we’re resolving at the moment to make it set up the widget automatically. Let me know if you need any pointers while configuring. Also, there’s this thread to reference: https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1595526846041300
Aug 3, 2020, 4:00 PM
Great! That's very helpful
user M
Aug 3, 2020, 4:03 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.