Replies: 4 comments 4 replies
-
(Converted this to a discussion because it’s currently working as intended.) One possibility is you could start adding a banner across the top of the page when a preview token is used. {% if craft.app.request.getIsPreview() %}
<div class="preview-banner">
You’re currently previewing unpublished content.
</div>
{% endif %} |
Beta Was this translation helpful? Give feedback.
-
Thanks Brandon. I was not aware of the getIsPreview() property and I guess this will do it. |
Beta Was this translation helpful? Give feedback.
-
Hi Brandon,
Any other ideas? Thanks, |
Beta Was this translation helpful? Give feedback.
-
Any chance for a backport to Craft 3? and thanks! |
Beta Was this translation helpful? Give feedback.
-
What happened?
Description
I would like to be able to detect expired preview links. Currently I get the correct preview content as long as the token is valid, afterwards I get the published content instead.
Why? Because our editors send out preview links to colleagues and the colleagues never know if the content they preview is the published or the modified content.
Steps to reproduce
Expected behavior
I would either like to show the user a warning or redirect him somewhere else, if the preview token is not valid anymore
Actual behavior
I do not see a way to notice if it's preview or not
Craft CMS version
3.8.17
PHP version
7.4.33
Operating system and version
Linux 5.10.104-linuxkit
Database type and version
PostgreSQL 12.14
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
Agnostic Fetch
Asset Interceptor
Blitz
Cloner
Conditional Fields
Control Panel CSS
Cookies
Glossary
Imager X
KeyChain
Minify
Neo
Preparse Field
Publisher
Redactor
Redactor Anchors
Relax
SAML Service Provider
Sprig
SuperSort
Super Table
Typed link field
Beta Was this translation helpful? Give feedback.
All reactions