Recommended way to exit preview

Hey,

I’m currently creating a site for a client using Next.js + Prismic.

I have setup the in website preview with the purple toolbar. I was wondering what is the recommended way to allow clients to exit the preview. I can’t see anything built into the preview toolbar.

I can see that there was a exit-preview endpoint in the next.js example I used. But there isn’t a UI element to interact with it.

Do I just create a custom one myself?

Hi @delanebobdesigns, when you have a preview running, there should be an “X” button in the purple toolbar which will remove the preview cookie and exit the preview:

Give that a try!

This will close prismic toolbar and clear the prismic preview cookie, however when using next, for example, we also have a local cookie that enables the system to go straight to prismic and get the correct preview content.

When clicking on Prismic X we also need to clear the cookie on our side, commonly done by calling the /api/exit-preview endpoint.

Can we customize the X button so that is also preforms this action when being clicked?

Thank you

@joao Unfortunately this sort of customization isn’t possible and there aren’t any plans currently to add it. I suggest submitting an issue/feature request on the toolbar’s github and/or submitting a PR to add it so our dev team can consider it:

This issue has been closed due to inactivity.