What is XPM Session Preview?

I’ve recently been working with a client on a project to implement Experience Manager on their existing Tridion managed website. The detailed requirements for the sprint story covered getting Experience Manager fully working on their Tridion Sites 8.5 implementation - including Session Preview. ‘No problem’ I thought, having implemented Experience Manager and SiteEdit (the earlier incarnation of the product) a few times in the past.

Getting the basic Experience Manager functionality up and running (without Session Preview) went pretty smoothly and happened pretty quickly. However, like many implementations, getting Session Preview working proved a little more tricky and left us, initially, with the dreaded, repeating “Your content is out of date” notification.

Session Preview's 'Content out of date' notification

Initial investigations identified that the XPM markup being output was incorrectly formatted and lacked the ‘last modified’ date attribute. ‘Job done!’ I rather prematurely thought.

After re-deploying the (DD4T) application and refreshing the page, we were still seeing the pesky “Your content is out of date” notification.

A couple of additional fixes were implemented, but the frustrations continued. Just when we thought we had it cracked another intermittent problem would occur.

Ultimately, all of the frustration and back and forthing with the Infrastructure and client’s Development teams led us all to the questions of “What exactly does Session Preview give us?!”. After much scouring of the internet we were still unsure of exactly what benefits Session Preview gave the editor. The online documentation gives very little detail, and just contains the following statement:

“If you disable Preview, modifications to the current Web page do not appear to users until the modified content has been published.”

From what we could deduce at the time, without Session Preview editors would still be able to update content on the Staging site using Experience Manager, and this would be saved back into the Content Manager, but that it would not be immediately obvious to returning XPM users if changes had been made previously but not published.

This proved to be true and the animation below shows this scenario.

Animated video of Experience Manager with Session Preview disabled

As can be seen, it’s not immediately obvious that there were changes already in the Content Manager that weren’t published to Staging, but upon clicking on a text field the contents are replaced with the latest version from the Content Manager. This is almost identical to how the old SiteEdit implementation worked - before Session Preview came along.

As well as notifying editors that the content on the Staging site is out of date, Session Preview allows XPM users to click on the “Update Preview” button and the latest content from within the Content Manager is rendered. The animation below shows what should happen with a fully working Session Preview implementation.

Animated video of Experience Manager with fully working Session Preview

Anyway, after further investigation with the client’s web team, it appeared that the root cause of our Session Preview problems was that although the page content was not cached within the customised DD4T web application, the Page Metadata was - this led Session Preview to be unaware of when the page was last published.

Somewhat surprisingly, and as highlighted in Neil’s 'session preview between editors on the same page' Tridion Stack Exchange question, clicking Update Preview renders the latest saved content within the Content Manager, regardless of whether: (a) The content has been checked-in or not, and (b) it was for the current user or not.

This observed behaviour seems to go against what the online documentation says should happen (i.e. that XPM editors should only see changes that have either been checked-in, or, if not checked-in, were made by themselves). Arguably, the way that Session Preview actually works (showing all changes), is actually more useful.

In the next post I’ll be looking at how and where to add content to the page using Experience Manager. In the meantime, if you need help with you XPM implementation, please contact me directly at j.williams@wearestagetwo.com or ask over on the Tridion Stack Exchange site.

Other blog posts in this series include: