Go Back

How Embedded Templates will Change Your Life

Sitefinity - ASP.NET CMSSitefinity ASP.NET CMS is deigned to be very flexible, extensible and customizable.  However, in the past customizations required modifying the Control Templates included in Sitefinity.  Managing these customizations during deployment & upgrades was sometimes cumbersome. 

With Sitefinity 3.6, these templates are embedded into the assemblies (DLLs).  Ivan Osmak detailed the advantage of embedded templates on his blog:

One of the major new improvements are embedded control templates. By embedding templates we were able to drastically reduce the number of files that comes with Sitefinity website, but even more importantly, we have ensured that on upgrades we do not override your customized templates anymore.

This represents a fundamental shift in how resources & customizations will be handled in future versions of Sitefinity.

Fewer Files = Fewer Problems

In J. Edward Anderson's 15 Rules of Engineering Design, rule #11 is:

Minimize the number of moving parts. Some engineers become fascinated with extremely complex designs, but they all too often are subject to more failures and end up with higher life-cycle cost. Examine carefully the function of each part.

Web sites don't have moving parts, but they do have files.  These files need transferred during deployment and managed during upgrades.  Web site files represent "moving parts" and introduce additional complexity.

The use of embedded resources & templates is part of a long-running trend of reducing the overall size and complexity of Sitefinity.  This makes it much easier to manage & deploy a Sitefinity installation.

Sitefinity Number of Files Graph

Sitefinity 3.6 is 12% smaller than 3.5 and 55% smaller than 3.2.  The number of Control Templates in Sitefinity 3.6 was reduced by 35%.  This trend will continue with future versions of Sitefinity.

What Happened to my Customizations?

Sitefinity has always invited developers to customize the product.  In the past, many of these customizations were made directly to the Control Template files included in Sitefinity.

  • ~/Sitefinity/ControlTemplates
  • ~/Sitefinity/Admin/ControlTemplates

This made it difficult to maintain clean separation between My Stuff and Sitefinity's Stuff.  Customizations to the product became co-mingled with Sitefinity's core files.  During upgrades these customizations would be overwritten or broken. 

Embedded templates make it impossible for Sitefinity to overwrite your customizations.  Sitefinity's Stuff is embedded inside an assembly file.  Unless instructed otherwise, Sitefinity will use these embedded templates.  Any Sitefinity customizations that exist will be contained in separate files and never overwritten.

Making Customizations to Controls in Sitefinity 3.6

To use a custom template with an existing Sitefinity control, simply point the control to your own custom control template.

For example, I wanted Sitefinity Watch to use a custom template for the BlogPosts control.  To do this I clicked Edit for the control, clicked the Advanced tab and pointed Sitefinity to my custom control templates.

Sitefinity BlogPosts Control - Custom Control Templates

The custom control template I use must contain certain required webcontrols.  The required webcontrols will vary from control to control.  For reference, download the embedded templates included with Sitefinity from this KB article

These templates can be used as a starting place for your customizations.  Find the template you're interested in using, modify it, save it to a location of your choosing and then point a control to this new template.

Comments  4

  • Patrick 19 Feb

    Hi Gabe, Thanks for the info.
  • Marko 19 Feb

    Amen!!! As always, thanks for the great info, Gabe! We haven't started our "move" to 3.6 yet, but I can tell you that instead of the usual oh-my-god-I-have-to-update-sitefinity-again [dreadful] feeling, I now I have a more calm, my-life-may-have-a-purpose-after-all feeling... :-)
  • Adam Crandall 19 Feb

    Hey Gabe This is great, will it also be possible to set these custom templates globally using a config file?
  • Antonio 26 May

    It is nice to see that Sitefinity has moved to using embedded templates. However, it is possible to make changes to the style of these controls without creating custom controls? Also, will sitefinity be making it much easier to update the control's look and feel by implementing an user friendly interface for modifying control's style sheet? (You can visit this website for further details: http://www.digital-web.com/articles/integrating_css_with_cms/)
Post a comment!
  1. Formatting options
       
     
     
     
     
       
  2. I'm sorry for the CAPTCHA. You have spammers to thank for this: