1
votes

Today I got into weird condition. I was doing Redirect for Sitecore item over IIS rewrite module. When I preview item from publish tab preview, it is redirecting properly. But when I preview item from presentation tab preview command it is not redirecting i.e. showing item presentation.

So there are two different preview behaviors for the same item, it strike me to think about difference between these two preview options.

  1. Under Publish tab: Preview Command
  2. Under Presentation tab: Preview Command

Please don't tell me that one preview mode open in new browser tab whereas second not :) , I am asking about feature wise difference.

2
what is your rewrite rule?Marek Musielak
^(http://)?Domain/Itemname/?$Pankaj Tiwari

2 Answers

3
votes

There are not many differences that I know of. But one of them is; that the Presentation Tab Preview runs in the context of your "website" site definition; the Publish Tab Preview spawns a new window that uses whatever domain name you used to "hit" your Sitecore. Or put in a different way; the host name will map you to your correct site definition (config) when using the Publish Tab - the "inline" Preview Tab won't use this option.

This is the most likely cause, you're seeing differences in behavior.

Here's a URL from the Presentation Tab: http://edit.edit.dev/home-node-name/edit-edit?**sc_site=website**&sc_lang=en&sc_mode=preview&sc_duration=temporary&sc_device=%7bFE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3%7d

And the same URL from the Publish Tab: http://edit.edit.dev/?sc_itemid=%7bB307A010-FF0B-4D0C-892F-EFF7C9A01AD4%7d&sc_mode=preview&sc_lang=en

Not sure when this made it into the config files, but it appears this is all controlled by this pipeline (in web.config):

  <getPagePreviewUrl>
    <processor type="Sitecore.Pipelines.GetPagePreviewUrl.GetDefaultUrlOptions, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetPagePreviewUrl.SetLanguage, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetPagePreviewUrl.GetUrl, Sitecore.Kernel"/>
  </getPagePreviewUrl>
2
votes
  1. Under Publish tab: only users with the relevant publishing roles/access can see this tab and have the ability to open a new window to preview in the context of the site (in a multi-site solution). This is likely often used and similar to Page Editor, without being able to actually edit.

  2. Under Presentation tab: only users with the relevant designer roles/access can see this tab and have the ability to open a tab in the shell interface to simply preview the presentation layer. This is likely not used often as Page Editor is more likely to be used and almost the same thing as the mode above.

As Mark said, they will have different URLs possibly and query string params. I recommend you compare them to see if your re-write rules meets both.

Also, I have a blog post about this same issue when getting the context site. Although it's not 100% relevant, it does have code that shows what parameters you can expect in one mode vs. the other.