Next.js Preview

Hi everybody

I’m using Dato CMS together with Next.js and the new preview feature released in 9.3.
It’s working fine so far and I’m able to bypass the static site and live preview changed content by manually open the relative url (e.g. /api/preview?secret=SECRET&slug=some-post).

What I’d like to have now is a button somewhere in the sidebar or at the top were a user can click to prevent manually entering the url. I tried the following 3 plugins which all didn’t work for me:

  • datocms-plugin-preview-link
  • datocms-plugin-full-preview-links
  • datocms-plugin-preview-links-spotlyte

Before I start writing my own plugin, what’s the recommended approach here?
Would you maybe consider adding a permanent preview button (next to Deployment status?) like prismic does it? This is super convenient and one thing that I’m missing from Dato CMS.

Thanks for your feedback,

Hello @damianfrizzi and welcome to Community :slight_smile:
I’m very sorry for the delay here, but I missed your message before :frowning:

In your case we don’t have anything yet, but you need something like this:

The only issue is that with Gatsby you can query the slugs and get the most similar to the slug field of the record. With Next you might have to build something yourself.

But if you start by having a look at the plugin’s code you might have a good start!

Hey @damianfrizzi,

What do you need updated with the preview link plugins you mentioned? I manage one of those and it was made quickly for our particular use case.

Hit me up and I can make updates to it so that it’s useful for you. I’m also in the process of refactoring a site to next 9.3, but haven’t gotten to the preview links yet, but if I do I can update this thread.

Happy to help!

1 Like