How do you set up live preview for headless Craft CMS installs connected to Gatsby?
1 Answer
When you enter live preview in the cp, it's an iframe to the URL you've set up for that section, including a token=xxxxxxxx
, you need to pass this along to your GraphQL (assuming that's what you use), to let it know it's not supposed to fetch data from the database.
Andrew Welch has a bit more info about it here: https://nystudio107.com/blog/headless-preview-in-craft-cms
As well as another question here (based on vue, so you probably need to change som stuff for Gatsby): Live preview using Vue.js
-
How should I configure the frontend application url on craft? I'm trying to do this, but I didn't find a way so far. The frontend application is already looking for a token parameter to send it back on graphql requests. Could you help me on this? Commented Jul 22, 2021 at 19:00