In our templates, we have conditional statements based on the render mode that determine whether (some of) the JSP code will be emitted. (Obviously, in an old-school preview, you don't want JSP code, while on a published page, you have an application server available.) Suffice it to say that in Preview mode, our JSP code won't execute, even on the application server.

Experience manager uses the preview render. My first question is why on earth this might be the logical choice, as Experience Manager pages are served from an application/web server. Would it be a bad customisation to force it to use Publish mode?

Is there any way to get Experience Manager to use the Publish render mode? I'm not aware of a configuration setting. Perhaps in the events system we could modify the publish instruction, but then we'd have to be able to detect renders that were coming from Experience Manager? Is this possible? What other approaches might be viable?

1 Answer 1


I think that the CM rather than the publisher renders the content for session preview, and that it does so in preview mode so that it takes the currently checked out version of the component with the very latest changes, including any changes that may need to go through workflow (i.e. the v0). It's ok to do this as the session preview is just for the current user making those changes anyway. It's the CM itself that sends the preview content to the OData web service, not the publisher (you probably knew that already!)

I believe you can detect a session preview render by checking for the existence of a publication target in combination of preview mode. On my phone right now so I can't find the exact code you need but I'll try to find an example later.

UPDATE: Thanks Will for adding the following info while I was travelling:

You can detect a Session Preview Render with the following statement:

bool isXpmPreview = engine.RenderMode == RenderMode.PreviewDynamic
    && engine.PublishingContext.PublicationTarget != null;
  • in your TBB code: bool isXpmPreview = engine.RenderMode == RenderMode.PreviewDynamic && engine.PublishingContext.PublicationTarget != null;
    – Will Price
    Commented Nov 25, 2015 at 19:57
  • Right - so actually I /should/ be using preview mode, but I can detect a fast-track render, and modify my templating output accordingly. Thanks. Commented Nov 26, 2015 at 8:39
  • Thanks @Will... Knew it was something like that but I was on my phone and headed to the airport... Will add to my answer. Commented Nov 26, 2015 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.