Sitecore best practice #2: Pages want to be viewed

31 May 2011
Adam Najmanowicz
Frink_Cognifide_2016_HeaderImages_0117

Sitecore best practice #2 is about showing the author the preview of a page immediately after clicking the page node in the tree.

When your authors use the Content Editor, they will likely use it to get to a page. Therefore, I feel that it is useful to enable the preview of the page for every "browsable" content item. What I mean is that whenever your CMS editor navigates to a page in the tree that can be seen by a visitor, it is beneficial to reassure them they've reached their destination and are able to start editing it. If you have read our best practice #1 - Home is where my Buttons are, you may have noticed that I've added the "Preview" button to the Home tab in the ribbon, but to be honest, I'm not convinced the user should have to manually click there to see the preview. Why not have an intermediate item template in your project that you are sure will always remain a page and simply, enable the preview over there by default? After all, the final product of your editor's work is a page. Naturally, the editor would want to see it almost every time they update/ save the page. Why should they be enabling it?

Consequently, the Sitecore best practice #2 has been defined as follows...

What is it about?

Items representing pages (i.e. having layouts that are viewable in browser - should have the preview tab enabled. Sitecore's term for the tabs visible in the Content Editor is Editors. The list of all available Editors is stored in the core database, under the /sitecore/content/Applications/Content Editor/Editors/ node. However, you don't need to alter it. The Editors, open by default, are defined by the specific item's template.

Why Should I do it?

When an author goes to a place in a tree, they don't think "content items", they think "pages". They don't think in terms of "oh this page has multiple layouts (or none at all) so a presentation may not be there". They think "How does this thing look?".

EPiServer got it right and unfortunately, Sitecore doesn't enable it out of the box, i.e. by default, the Sitecore Preview tab is hidden. Expecting the author to enable it themselves every time increases the training cost and time, and inevitably, adds to the tediousness of their daily job.

Demo scenario Preview Tab Enabled

How do I implement it in my project?

1. Using Content Editor, navigate to /sitecore/Templates/ and locate your base page template. All the children templates will inherit those settings from their parent.
2. If the __Standard Values subnode does not exist yet, select Configure -> Template -> Edit from the Ribbon, then Builder -> Options -> Template -> Standard Values. This will insert a new node below.

Add Standard Values

Edit Standard Values

3. With __Standard Values selected, select Configure -> Appearance -> Editors and add the Editors/Layouts/Preview editor. The other layout editors are somewhat useful when creating page layouts but would be confusing for the author if enabled by default (Grid Designer show an overview of Sitecore controls layout on the page, while Html Viewer presents the raw .aspx code).

How To Add Preview Tag

4. Save the template and publish your changes.

Big thanks to Leszek Ciesielski for his research and help on the Sitecore Best Practice #2.