👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Set up Draft Previews with Gatsby Cloud Hosting

3 replies
Last updated: Aug 26, 2020
Hi guys, I am working on one gatsby-sanity-netlify stack at this moment on one of my projects. But, I am having some questions to ask, can anyone suggest, how to implement live web preview in sanity for new blog posts, I know it's working for existing posts or published posts, for which pages are already generated in gatsby, but as a content editor one needs to see live web preview for the unpublished posts as well. If anyone have gone through this in past & have some solutions then kindly help me here..
Aug 26, 2020, 10:35 AM
You'll need to run the live preview server somewhere. The easiest way is to do so in Gatsby Cloud, or you can self host it:
https://sanity-io-land.slack.com/archives/C9YQ161LZ/p1597705361144400
https://www.simeongriggs.dev/roll-your-own-gatsby-live-preview-for-sanity
https://medium.com/the-couch/live-preview-in-gatsby-without-the-cost-21f8ac0337bb
https://www.sanity.io/blog/get-started-with-gatsby-and-structured-content
https://www.phmu.de/blog/real-time-preview-for-gatsby-websites-with-the-sanity-io-headless-cms/ The key here is to set up the plugin to have
overlayDrafts: true
 and provide it a token with read permissions in the preview environment, so that the listeners can access the drafts.
Aug 26, 2020, 11:17 AM
Thanks a lot
user Y
, I will take a look on all the links that you have shared, I really appreciate your quick help & response..
Aug 26, 2020, 11:21 AM
No problem! I'm sure you'd find even more pointers by searching this slack btw! And do join the gatsby channel as well
Aug 26, 2020, 11:32 AM

Sanity– build remarkable experiences at scale

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

Was this answer helpful?