. Not sure this is quite it. For context, my use case is with gatsby. This solution you pointed to, this is just for articles that have not yet been published right? What would be ideal I think is if I had some way to "publish" pages to a draft status, that a front-end could either build or not build, based on some flags set for prod or preview environments.
The issue to me really is that I don't know of a way to check what a page looks like in the front end without publishing the content. This leads to unfinished work being "published", and the hazard that it may get pushed out along with some other change that we want to push live
Apr 21, 2020, 7:37 PM
Thanks for the extra context! Indeed, what I suggested is just for when you create new documents using the API. If I understand correctly, what you’re essentially looking for is a way to preview drafts in development and only published documents in production. When you make changes to a document in the Sanity Studio, these changes are saved in the draft version of the document until you hit “Publish”.
Assuming you’re using `gatsby-source-sanity`: have you tried adding a
to true? This will let you ‘overlay’ the draft version over the regular version of the document in development. If you want it to update on every keypress, you can also set
to true. The auth
you can create via manage.sanity.io > Your project > Settings > API. You’ll want to create a token with Read permissions in this case. Here is some additional information on keeping tokens secure, just in case: https://www.sanity.io/docs/keeping-your-data-safe By settings things up this way, you should be able to preview drafts in development while only using published documents (and not drafts) in production.