I’m having quite a bit of trouble trying to set up Prismic previews and I’m hoping to get some help.
Here is a sample of what my gatsby-config and link-resolver look like:
(/preview/ is set in the Prismic preview settings, including the trailing slash. I heard there are issues with no trailing slash + AWS + Prismic preview so I added it here, though I haven’t gotten so far as to test that yet. Also not sure if I should be using
previewPath here. The Prismic docs say
path but looking at the source of the plugin, I think this has been changed to
Here are some of the issues I am facing:
- I’m pretty sure I’ve gone through all the steps to set up previews (I followed this as well as a lot of looking around), but when I make a change in e.g. the homepage in Prismic, save it and then click on the preview button (set up for localhost), I get the Gatsby dev 404 page (see screenshot). If I then navigate to /homepage/preview (the
previewPathI set up in gatsby-config) then the preview appears to work for that page. Interestingly, it also seems to work if I navigate to /en, which is our homepage URL. How do you normally handle this? I assume the preview button is supposed to redirect me to the correct page (not sure if that should be /homepage/preview or /en in this case).
If I make a change to a document in a locale other than the default locale, e.g. Danish, and I click the preview button, I still get the 404 page, but even if I then navigate to the preview path (/homepage/preview) I see the English page and none of the edits. If I go to /da (Danish homepage) I can see the correct locale as well as the live preview edits. This last case seems fine, but then I’m not sure what the point of setting the preview paths is(?), and I guess it should automatically direct us there when clicking the preview button from Prismic.
A lot of my content in Prismic is split out into components. I guess there wouldn’t be a certain preview path that would make sense to show when editing content in this, as they could be used in various pages. Do you have any suggestions on how to handle this?
I am using the
useStaticQueryhook for content queries in components. I see it says in the plugin README that this isn’t supported, but it has seemed to work for me. Is it just for previews that it doesn’t work (seems to be the case)? I see an example of using
StaticQuerycomponent - do you know if it’s possible to get it working with hooks, or do I have to refactor to use the
StaticQuerycomponent (this would be a bummer)?
As I mentioned, my content models are very componentised, so the content for any given page may be shared between different components. Is it possible to view live preview changes across different components and/or across different locales in one preview session? It seems like a preview session only shows changes for the document that initiated the preview?
Any help would be much appreciated.