LibrarySites.Banner

Evaluating BrainJocks SCORE for the Sitecore ASP.NET CMS: Snippets

This blog post, specifically about the snippets feature, is one in a series of blog posts describing my evaluation of BrainJocks SCORE for the Sitecore ASP.NET web Content Management System (CMS) and Experience Platform (XP). You can think of a SCORE as an accelerator for the implementation of Sitecore solutions. For more information about SCORE, see the links in the Resources section at the end of this page.

First, a terminology clarification. The Sitecore Rich Text Editor (RTE) provides a feature called snippets, which is completely unrelated to snippets in SCORE. RTE snippets are simply preconfigured static text strings that CMS users can insert into Rich Text Editor fields. SCORE snippets are much more powerful and dynamic, supporting dynamic reuse of content, logic, and presentation.

You can use SCORE snippets to manage the logic and markup required for components of any complexity. Each snippets consists of a number of components that CMS users edit, typically in the Experience Editor. You can then use that consistent snippet in any number and type of pages rather than defining those components for each page or type of page that requires those same features. Snippets help to achieve advanced functionality with reduced code, especially hard-coding. You can think of snippets as advanced presentation components available globally so that you can use them any number of times.

Simple examples of snippets include headers, sidebars, and footers. You might think that you can implement those as renderings, and in fact, snippets are simply very powerful renderings. One difference between simple renderings and snippets is that snippets can aggregate numerous presentation components that include personalization, testing, and other conditional rendering features common to your entire site. You can treat a snippet as a single presentation component to collects the logic, configuration, definitions, and data for all of these features. When you update the data used by a snippet, you update all pages that use that snippet automatically.

SCORE snippets involve at least two components (and often a placeholder). A general snippet component (an MVC rendering) renders snippet items. Layout details for the content item typically bind the snippet presentation component to a placeholder, using a data source to indicate which snippet items the snippet presentation component should render. Individual snippet definition items encapsulate data for a single visual snippet, although each presentation component used by the snippet can have its own data source item as well.

Functionally, snippet rendering works as if the presentation components associated with the snippets definition items exist in layout details for that content item itself. Snippets provide reusable groupings of logic (presentation components) and data (content, data sources, conditional rendering rules, or any other type of items or layout details data that a presentation component or the rendering process could access). You can insert a snippet into any number of pages without using an iframe or placing an HTTP request from the server to the server – just generating normal output.

A snippet definition item has layout details, just like a content item used to render pages. When inline editing a content page in the Experience Editor, any of its snippets appear read-only, with links above them that allows the CMS user to navigate to a page that renders only the snippet, where that snippet page allows inline editing. This provides greater usability for snippets that often appear in narrow columns or other locations in the UI that could make inline editing awkward, and helps to remind users that any changes are not just part of the content page that contains the snippet, but could affect any number of other pages. Because the snippet presentation component typically composes output from a number of data source items, you can edit those items in the Content Editor as well as the Experience Editor, but BrainJocks makes it easy to use the Experience Editor. You can use any presentation component within a snippet, including any of those components provided with SCORE (accordions, navigation elements, and otherwise).

The quickest way to see snippets in action is to watch the three-minute video linked in the Resources section at the end of this page. When watching, remember that a snippet is a component used by multiple pages that CMS users can edit in the Experience Editor as if the snippet was a page standing on its own. For more information, you can request a demonstration from BrainJocks.

Resources