Detect Preview and Preview Date in Sitecore

Posted Wednesday, March 26, 2008 3:35 PM by Kevin

We have a piece of content on this site we're working on that comes from an outside system instead of Sitecore.  The client has requested that when they are previewing the site, this particular piece of content also be shown as a preview.  Luckily, the outside system allows us to request the content by date.  But I was unsure of how to find out if the site was in preview mode or if it was, what date was being previewed.

Unsure no more!  Jens on the SDN foum came through with this extremely simple solution...  Sitecore.Configuration.State.Previewing (boolean) and Sitecore.Configuration.State.PreviewDate (DateTime).  They do exactly what you'd expect.

No idea how I would have ever found those if it weren't for the SDN forum, though.  Thanks, Jens!

Filed under:

Comments

No Comments