3

I have a page whose menu bar loads fine when previewed by clicking Presentation > Preview.

When previewed by clicking Publish > Preview, the site's menu bar is overlapped by Sitecore menu.

To fix that, I want to add a margin-top css property for the menu bar when it is being previewed using Publish > Preview.

How can I do that, as for both the methods, the page mode is Sitecore.Context.PageMode.IsPreview

2

Presentation-preview is designed for Content Editor Users, Publish-preview - for Page Editor users. This is the main concept difference, in my opinion. Technically they use different engines: the presentation-preview uses the one inherited from old 5.3/6.0-6.3 versions, and the publish-preview uses Page Editor Engine invented in 6.4 versions.

Publish -> Preview also provides other options such as allowing you to choose the device while previewing. On the other hand, Presentation -> Preview uses the first device that has "Default" field checked under the /sitecore/layout/devices item

So my suggestion is to forget to use Presententation -> Preview , recommended practice in Sitecore is to use Experience Editor not Content Editor for editing pages.

1

Presentation Tab Preview runs in the context of your "website" site & Preview from Publish runs based on your site definition & hostname entry. Also you can check the URL triggered while accessing like below:

Presentation Tab: http://?sc_site=website&sc_lang&sc_mode=preview Publish Tab: http://?sc_itemid=&sc_mode=preview&sc_lang=

0

The Request.Url looks like below if you are in presentation->preview

http://hostname/en?uri=sitecore://master/{ID}?lang=en-GB&ver=8&sc_site=website&sc_lang=en-GB&sc_mode=preview&sc_duration=temporary&sc_device={ID}

The Request.Url looks like below if you are in publish->preview

http://hostname/?sc_itemid={ID}&sc_mode=preview&sc_lang=en-GB&sc_site=website

the main difference i spot is

uri=sitecore

based on that we can find whether we are in presentation preview or publish preview

var previewtype = Sitecore.Context.PageMode.IsPreview ? Request.Url.PathAndQuery.Contains("uri=sitecore") ? "presentation-preview" : "publish-preview" : "not-previewMode";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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