As I continue the climb to a better Coffeehouse experience through Sitecore Experience Accelerator (SXA) the next level of building blocks we have are Partial Designs and Page Designs.
Unlike the renderings we covered in the previous post, partial designs and page designs are tightly integrated, where one cannot function without the other.
The smaller and hence more re-useable block is the Partial Design. My first experiments with partial designs, I struggled to see how they differ from the idea of snippets. As both provide a way to apply x-number of renderings into a ‘reusable’ chunk. It turns out there are two major differences to keep in mind when determining which to build.
The first difference is that a snippet is a specific composite rendering that is to be placed in a single placeholder on a page. Whereas a partial design provides the entire page (or layout) to work from. The partial design is then overlay on the page instance’s layout, providing both content, renderings, and new placeholders (in the sense of rows and columns or containers.)
The second difference is that the actual content initially wired up in a snippet can be edited on from any page the snippet is used. (Which if not configured correctly can create instances of global changes unbeknownst to an editor.) Similarly, a change to a partial design will affect all references to the partial but can only be edited through the partial design and via a page that leverages it.
How you can apply a partial design is also another major differentiation from a snippet, in that partial designs are applied through the assignment to a Page Design and so cannot easily (if at all) be assigned by any content editor unlike a snippet which functions like any other rendering.
The final thing that helps to define partial designs it is ability to inherit from other partial designs allowing for very complex yet highly re-usable designs to be built.
When to Consider a Partial Design
Based on above brief introduction to Partial Designs, the question begs when to choose a partial design when planning and working within your site. You can use the partial designs to create the design elements of your pages quickly for a consistent style. For example, you can create parts of your page once, such as headers and footers, and then use them everywhere on your site.
Partial Designs allows for planning and creation of common (think heavily reused) collection of renderings and associated data for consistent appearance across your site. When constructing partial designs, it is important to allow it to focus on a single congruent element of a page, it is even possible to allow a partial design to have an open placeholder or two or three that page specific content could be placed as needed, while still maintaining a consistent page appearance.
Page Designs are the bridge between all those thoughtfully created Partial Designs and actual page instances of your site. Page designs can be assigned zero or more partial designs, which overlay each other into a page.
One thing to take note of is that renderings cannot be added to a Page Design. Page Designs are purely a bridge to get Partial Designs onto a page instance. This bridge type feature can be thought of like a branch template from traditional Sitecore development, with the benefit of being more easily updated to affect all related pages.
The full bridge affect can be seen in the following diagram
Page Designs can be assigned ad-hoc as new instances of a basic page are created or can be assigned via Standard Values to templates which are then instantiated in the site.