Kentico CMS 6.0 Developer's Guide

Previewing documents

Previewing documents

Previous topic Next topic Mail us feedback on this topic!  

Previewing documents

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

When you open the page in CMS Desk -> Content section, the default mode is Edit. This mode allows you to edit the page's content, design and properties.

 

devguide_clip0312

 

The other view modes are:

 

Live site - this mode shows the page as it's currently displayed on the live site to website visitors.

Preview - this mode shows you the page version as it will be published on the site before it's actually published.

List - this mode shows the list of all documents under the currently selected document. It's useful if you have many documents under a single parent document and need to browse them effectively.

 

The following points summarize the difference between the Live site and Preview view modes:

 

The Live site and Preview modes display the same content when a document is published and no further changes have been made to it since it was published.

The Preview mode does not use caching, so it may display published changes that are not visible in Live site mode yet due to caching.

When a document does not use workflow and its Publish from property is set to a future date and time, the Live site mode does not display any content, while the Preview mode displays the content that will be published after the specified date and time.

When the document uses workflow and didn't get to the Published step yet, the Live site mode doesn't display any content, while the Preview mode displays the content created in the current workflow step.

When the document uses workflow, it already got to the Published workflow step and its workflow cycle has been restarted (i.e. it was switched from the Published/Archived workflow step back to the Edit step and is going through the workflow cycle again), the Live site mode displays the last published version, while the Preview mode displays content from the current workflow step.

 

Preview URLs

 

On the Properties -> General tab of an edited document, you can find the Preview URL property. If you click the Show preview link next to it, a new window will be opened, displaying the current document in Preview mode outside Kentico CMS user interface.

 

devguide_clip1397

 

The document will be displayed on a special page with a dedicated URL. The URL can be sent to a person without access to Kentico CMS user interface to let them view content that is not published yet. At the top of the page, an info line is displayed, informing that the page is displaying a document preview in context of a specific user (the Show preview link is always leading to preview in context of the current user). Links on the page are intentionally not working, so the person who accesses the preview URL can only see the preview of the particular document.

 

devguide_clip1404

 

Preview links are also included in workflow notification e-mail templates. In this case, the preview is displayed in context of the user who performed the workflow action about which the e-mail is notifying.

 

devguide_clip1418

 

Generating new preview URLs

 

If you do not want the document's preview to be accessible under a link that you already sent to someone, you can generate a new preview URL for the document. This can be done by clicking the Generate preview link (RebuildIndex) button next to the Show preview link on the document's Properties -> General tab. By doing so, the document gets a new preview URL and the original one is no longer functional.

 

devguide_clip1417

 

Depending on the Allow permanent preview links setting in Site Manager -> Settings -> Content -> Content management, new preview URLs can also be generated automatically for documents under workflow when their workflow cycle is restarted (i.e. when they are switched from the Published/Archived workflow step to the Edit step). If disabled, new preview URLs are generated in this situation and the original ones are no longer usable. If enabled, original preview links are preserved when the workflow cycle is restarted.

 

Additional configuration for long URLs in .NET 3.5

 

URLs in ASP.NET can have a maximal length of 260 characters. This may cause problems with links in previewed documents (e.g. links to attachments of documents which are nested deep in the content tree). If these URLs are long on their own, they may potentially exceed the length limit because the preview URL prefix is pre-pended to in document preview.

 

If you are running Kentico CMS on .NET 4.0, handling of such URLs is pre-configured in the default web.config file, so you should not encounter any problems. If you are running Kentico CMS on .NET 3.5, you need to perform the following steps in order to avoid problems with such URLs:

 

1. You need to install the URL Rewrite Module into the IIS. It can be downloaded from the following location: http://www.iis.net/download/urlrewrite.

 

2. Add the following rewriting rule into the <system.webServer> section of the project's web.config file:

 

<system.webServer>

 <rewrite>

   <rules>

     <rule name="Remove virtual context prefix" stopProcessing="false">

       <match url="^cmsctx/(.+)/-/(.+)$" />

       <action type="Rewrite" url="cmsctx/-/{R:2}" />

     </rule>

   </rules>

 </rewrite>

 ...

</system.webServer>