treefarmstudio / astro-sanity-minimal-starter

https://astro-sanity-minimal-starter.netlify.app/
MIT License
105 stars 14 forks source link

Feature Request: Add support / demo of SSR Preview content #21

Open jasikpark opened 1 year ago

jasikpark commented 1 year ago

It would be great to demo how to render preview Sanity content in a live demo environment, maybe by serving https://github.com/portabletext/react-portabletext w/ client:load when in preview mode, to get live rendering of the content?

ex,

---
import {PortableText} from '@portabletext/react'
import { IS_PREVIEW } from '~/env';
---

{IS_PREVIEW ? 
  <PortableText
  client:load
  value={[/* array of portable text blocks */]}
  components={/* optional object of custom components to use */}
/> :
  <PortableText
  value={[/* array of portable text blocks */]}
  components={/* optional object of custom components to use */}
/>}