I'm currently setting up previews in my Gatsby project using gatsby-plugin-prismic-previews
and following the tutorials + docs.
I'm a bit confused about the role of a linkResolver
and the preview route.
Let's say I set my preview route to /preview
- is the idea that on my Gatsby site I should be able to visit mysite.com/blog
to see currently deployed Prismic data, and mysite.com/preview/blog
to see data which is in a release waiting to be published?
So far it seems that with my setup just going to mysite.com/blog
shows the preview without needing to change any URL settings at all. Is this what the linkResolver is supposed to do? I have it setup working locally, pulling the latest preview changes, but I don't quite know if it's set up correctly (eg/ am I meant to prefix all routes with /preview
). Thanks for the help.
Hello @jamesmbrightman, thanks for reaching out to us!
My apologies for the late response, and thank you for your patience.
If the preview route is set to /preview
in your setting, the idea is that when you make changes on your Prismic repository and haven't published the changes yet, you should be able to see those changes when you click on the eye icon on the top right in your document. The /preview
will redirect you to the base routes you created in your link resolver, e.g., /blog
and not /preview/blog.
The /preview
route's purpose is to redirect a content writer from Prismic to the correct page. After that redirect, accessing pages directly (e.g., /blog
) will continue that preview session. The session can be exited by clicking the "x" button on the Prismic toolbar in the bottom left corner.
You can check this out in our Preview Docs, linked below:
Thanks,
Racheal.