How to Set Up Content Preview in Development
IntermediateQuick Answer
TL;DR
Set up content preview by configuring your CMS to send draft content to a preview URL, implementing a preview route in your frontend that fetches draft content instead of published, and adding a visual indicator showing preview mode is active. This lets editors see unpublished changes rendered in the actual frontend before publishing. Sanity's Presentation tool provides real-time preview with visual editing built in.
Key Takeaways
- Preview mode requires a separate fetch path that bypasses the CDN and fetches draft content using an authenticated token
- A secret preview token prevents unauthorized access to draft content — never use your write token for preview
- Always show a visible "Preview Mode" banner so editors know they're seeing drafts, not the live site