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.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. Sanity.io comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Sanity.io. Free to get started, pay-as-you-go on all plans.

Related topics

Get more help in the community Slack

Go to How to deploy Gatsby sites using official Sanity starter templatesGo to How to generate RSS.xml files from Sanity posts with gatsby-plugin-feedGo to How to make Algolia work with Gatsby & SanityGo to How to improve image loading with Gatsby and gatsby-plugin-sanity-image?Go to How to Decouple the Kitchen Sink Starter from NetlifyGo to How to display Sanity images in Gatsby-powered photography sitesGo to Is it possible to use gatsby-image to render images loaded in Portable Text / Rich Text?Go to Deploy a Sanity + Next JS site to Netlify
TopicCategoriesFeaturedRepliesLast Updated
How to deploy Gatsby sites using official Sanity starter templates25Nov 30, 2020
How to generate RSS.xml files from Sanity posts with gatsby-plugin-feed6Jan 12, 2021
How to make Algolia work with Gatsby & Sanity8Jan 7, 2021
How to improve image loading with Gatsby and gatsby-plugin-sanity-image?10Nov 27, 2020
How to Decouple the Kitchen Sink Starter from Netlify8Feb 9, 2021
How to display Sanity images in Gatsby-powered photography sites19Jun 16, 2020
Is it possible to use gatsby-image to render images loaded in Portable Text / Rich Text?8Jan 1, 2021
Deploy a Sanity + Next JS site to Netlify6Feb 9, 2021

Related contributions

Jamstack Explorers
- Made with Sanity
- has 8 likes

Jamstack Explorers is a free learning platform created by the team at Netlify to chart a course through the amazing offerings in the Jamstack ecosystem

Go to Jamstack Explorers

Occo
- Made with Sanity

Complex product offering with nested product structure and tiered pricing.

Kevin Green
Go to Occo

Figma Config
- Made with Sanity

Website for Config, the global design conference by Figma.

Corey Ward
Go to Figma Config