Preview for Webhook Builds


I understand that Deploy Previews work together with Pull Requests. I have the following scenario and wonder what the best way is to handle this on Netlify:

  • I have a Headless CMS connected to my static site.
  • When somebody publishes new content in the CMS, a web hook triggers a new build.
  • I would like to be able to Preview this build under a fixed URL (e.g. before it it its published.

Whats the best practice to achieve something like this on Netlify?

Thanks for suggestions.

Based on what you’ve described, you could set up two sites in Netlify, one with URL of the main site and one with the URL of the subdomain preview site.

The preview site would be configured to rebuild on the content changes, while the main site would be configured to build only when explicitly told to do so (perhaps by a different “deploy the site” webhook).

Thanks @nathanmartin. Yes that’s what I have set up in my experiments. I wondered if there is a different, “state-of-the-art” Netlify way to set up something like this. But looks like I am going into the right direction.

I’m not aware of a specific Netlify way of doing it, but if you’re building with a system that can retrieve the appropriate draft data and render a route on demand, then you could expose that via a function and have previews that don’t require a full rebuild & redeploy.

We utilised a similar system for a few years, but now we host what is effectively a separate preview server running on heroku. The initial load for a content author is a bit slow (the low powered free heroku dyno waking up), but all subsequent page views are instant and reflect the realtime content changes.