Blog

Kentico templating tips

In this post I’d like to cover off some templating tricks and tips that we routinely use when developing websites built on Kentico CMS.

Inheritancy is very important when developing CMS-driven websites and in our opinion makes or breaks a site's ability to be usable and easily updated.

The majority of the difficult work goes into the planing stage, breaking up the template and setting the page place holders in the correct space. A good analogy of this is to create holes in the template that can be filled in the lower level templates.

Why is this good?

If you have text that is changeable but visible through child pages, you can set the template properties at the appropriate level.

It’s all about the DRY Method, Don’t Repeat Yourself, as there is nothing worse that than having to copy and paste the same text all over the website. With inheritancy you make the change in one place and every other page inherits that copy. You can of course tie these changes to a specific template, but by doing this we usually end up with many templates that are essentially the same but have slightly different side bar elements.

Here is an example of  how we've created a top level folder with a fixed side bar that is set at the parent level.

Template view 1

This makes it quite nice in a way that allows all the other template to just do what they need to, rather than have all the side content, that would need to be changed.

Template view 2

We've spent a good amount of time trying to find the the best way to use the inheritancy, and we find that no two sites are exactly the same. In this case, we inherit the top 2 levels of the template tree.

Template view 3

Within the additional inheritance features, you have alot of flexibility of being able to split out that content into manageable chunks.