Quick Tip: A Quicker Content Preview

This might come off as a bit obvious, but chances are it might be news to some people; Previewing content in Sitecore is dull. There, I said it. It takes a couple of clicks to get your page previewed (Hit the Publish tab and then Preview button). While this is not really a big issue, content editors find it time consuming (and a bit confusing).

As always with Sitecore, there are more ways than one to skin a cat preview content!

The Context Menu Approach

A quick, and simple way is to add an option to the content tree context menu, here’s how:

  1. Head over to your Core database (and as always, handle the Core database with care)
  2. Expand to the following path: /sitecore/content/Applications/Content Editor/Context Menues/Default/
  3. Create a new child called Preview (mine is directly below “Insert”), based on the MenuItem template (located in /sitecore/templates/System/Menus/Menu item)
  4. Set the following fields:
    Display name: Preview
    Message (under the Data section): item:preview(id=$Target)
  5. Save.

Now, switch back to your Master database and right click any item in the content tree and hit the new Preview option.

Preview context menu

Bonus: Auto Preview Content in Content Editor!

Another quick way to preview content is to add the preview “Editor” to items. Here’s how:

  1. Go to the __Standard values of the template item
  2. Enable “Standard Fields” (Hit View > Check Standard Fields in the Ribbon)
  3. Scroll down to Editors in Appearance section of the template and hit Edit button.
  4. Select the “Preview” editor (it’s under Item Editors > Preview) and select it (by double clicking or highlighting and clicking arrow right button)
  5. Preview any content based on this template automatically when the item loads in the Content Editor.

(Hint: Define a base template for all items that render as web pages and assign the editor there, then inherit this template for all page items for automatic preview everywhere).

Nice, innit?

 

Posted in Sitecore Tagged with: , ,
2 comments on “Quick Tip: A Quicker Content Preview
  1. Eelko says:

    Nice it is! Besides the preview function a publish button in this menu would also be a great addon… i constantly try to publish from contextmenu, but it still isn’t there :0

    • Andreas says:

      Actually, it’s not hard at all!

      Just replace the Message field with item:publish(id=$Target) (and change Display name, obviously).

      I’ve also made customization to allow “quiet publishing” which suppresses the confirmation dialog, but this is a nice one too!

      (oh and item:quickpublish(id=$Target) might be of interest too! Check commands.config for other ideas…)

Leave a Reply to Eelko Cancel reply

Your email address will not be published. Required fields are marked *

*