Detect Preview or CMS Request Context - BloomReach Experience - Open Source CMS

This article covers a Hippo CMS version 11. There's an updated version available that covers our most recent release.

04-07-2016

Detect Preview or CMS Request Context

In your template, you might want to only include some HTML if the request is for a preview version of the site, or when the request is from the Channel Manager.

You can check this in your JSP template as follows:

<hst:defineObjects/>
<c:set var="isPreview" value="${hstRequest.requestContext.preview}"/>
<c:set var="isCmsRequest" value="${hstRequest.requestContext.cmsRequest}"/>

or in Freemarker:

<@hst.defineObjects/>
<#assign isPreview=hstRequest.requestContext.preview/>
<#assign isCmsRequest=hstRequest.requestContext.cmsRequest/>
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?