Is it possible to differentiate between different types of preview?

The preview button lets you preview pages at different stages (for example published, saved-but-not-yet-published, and scheduled-to-be-published). How can the preview endpoint differentiate these so it can eventually redirect the user to a different URL for each?

For example, let's say I have an about page.

  1. Clicking the preview when the page is published would go to mysite.com/about/
  2. Clicking the preview when changes have been made and saved, but not published would go to mysite.com/about/preview
  3. Clicking the preview when it's a scheduled release would go to, for example mysite.com/about?scheduled=2020-11-05

The point of this is that the end user is made aware through the URL what they are viewing (e.g. published page vs scheduled preview for a particular date).

Is this possible? I can see that the preview token has different structure seemingly based on the type, e.g. separators like : or ~, could these be used to figure out what type of preview this is? Is the token structure documented somewhere?

Hey Martin, welcome to the forum!

The Preview button adds a cookie when a user hits the preview button. This cookie contains the preview ref needed to call the API and receive the proper content. You can know if the preview comes from a release / draft or from a published version by the name displayed in the Toolbar. e.g Let's say you share the preview link with your client:

A live version, will have the title "Live now":

A release will hold the name of the current release where you started the preview from:

And a draft will have the Display Name of the document as the Toolbar title:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.