7 YEARS AGO

Tips and Tricks: 1. Page template reduction - Template scopes

This is the first post of a series of tips and tricks on page template reduction techniques. From my point of view it is very important that you only provide the page templates needed to your end users, making sure that they will not get lost when managing the website. This tip will show you how easy it is to create "Template scopes", to filter the "Page template selection" dialogue.

This is the first post of a series of tips and tricks on page template reduction techniques. From my point of view it is very important that you only provide the page templates needed to your end users, making sure that they will not get lost when managing the website. This tip will show you how easy it is to create "Template scopes", to filter the "Page template selection" dialogue.

A note before we start: I have installed a clean installation of Kentico CMS 5.5R2 and applied the latest hotfix. I then installed the "Corporate website template", which I will be using throughout the page template reduction tips and tricks.

If you take a look at the "Page template selection" dialogue (when creating a new page for example), notice the amount and diversity of available page templates. While this is really nice to have when you know the CMS and when you know the different types of contents Kentico offers out of the box, it can be confusing for end users that are new to Kentico. I therefor definitely recommend to limit the "Page template selection" by filtering out the templates that are not likely being used and (in my opinion) shouldn't be available in the first place.

To clarify this, I will assume that master templates should only be available for the document root (master page) of the website and should not be available for documents of type pages. I would therefor like to filter them out of the "Page template selection" using so called "Template scopes".

template_selection.png

Let us create the "Template scope" for the "Blank master page" template by going to the "Site Manager" --> "Development" --> "Page templates" and select the "Blank master page" template. In the "Page template properties" on the right side of the screen, select the "Scopes" tab.

This tab allows you to create "Template scopes" either globally (applied to all websites in the Kentico instance) or specific to a website. For this demo choose to create a scope for the "Corporate site".
 
Click on the "New template scope" button and fill in the form as shown in the following screenshot:

template_scope.png

Because we want to create a scope for the document root, we will need to specify the slash for the starting path, select the "Root" document type, and tick the box for level 0. This will make sure that the template will only be available for the root document of our website.

Simply save the changes and view the result by creating a new page like we did earlier and notice that the "Blank master page" template is not available anymore.

template_selection_with_scope.png

Just to make sure the "Template scope" works, select the root document --> "Properties" --> "Template" and click on the "Select" button. Notice that the "Blank master page" template is indeed available.

template_selection_root.png

To wrap this tip up: think of using template scopes to make sure page templates are only available for certain document types or certain levels. A nice and simple way with great result!

The next tip in this series will show you how you can specify default page templates for document types.

Stay tuned...