Reputation: 15
I am building a blog page using gatsby and contentful.
I finished setting up the live website using delivery API, and now trying to set up the preview page. I want it to work so that when I click "Open Preview" button from the content, the exact draft I was working on pops up on a preview page. In that way, I can check how it will look like in live website.
right now in my gatsby-config, I have two different plugins, one for preview and one for delivery.
{
resolve: `gatsby-source-contentful`,
options: {
spaceId: `space-id`,
accessToken: `preview-access-token`,
host: `preview.contentful.com`
}
},
{
resolve: 'gatsby-source-contentful',
options: {
spaceId: 'space-id',
accessToken:
'delivery-access-token'
}
},
like this. But I'm not 100% sure what I should do after this. How do I make a preview page using this?
Upvotes: 0
Views: 1160
Reputation: 80041
I don't believe you're able to use the live Preview API with Gatsby without doing a full rebuild. You might have luck using a Netlify site integrated with your Contentful event hooks.
In any case, configuring multiple instances of gatsby-source-contentful
is unlikely to go well. You probably want to use ENV to provide the API and host, then configure Netlify (or wherever you're building) to use the appropriate token and host for the desired result.
Upvotes: 1