Friday, September 8, 2017

Sitecore Practical Series-2 -Understanding SitecoreTemplate structure and best practices.

Understanding SitecoreTemplate structure and best practices.



Template - 'This is basically a structure to store the content, like designing a table.

In the previous session - 


  1. We have covered how to setup visual studio 2017 and key features:- http://jitendrasoni.blogspot.co.uk/2017/03/visual-studio-2017-quick-intro-and-walk_19.html
  2. We have covered how to setup development machine - Including Visual Studio 2017, Sitecore, Rock etc.http://jitendrasoni.blogspot.co.uk/2017/08/sitecore-practical-series-1.html

This would be the third steps to understand the Sitecore template, sections, fields, fields type and some key features.

Let's start.

1. Login into Sitecore and go to template section




Create a new folder at the root level.

Tip#1 - Make sure while defining the first folder for the project, It should be considered at the root and have all multisite, components and settings inside to this.

Here, I am giving this a name - MainProject




While creating a template there will be three options, As mentioned below.




Define a high-level folder structure for your site.

Tip#2 - Before creating a basic IA design, Please do a home work like how you are planning to structure your site.
Tip#3 Befo Either you can use a UML design for the reference or use excel sheet to design the template and relationship for base and section

Basic folder structure will look like this.

More details will cover in next advance section.




As I said this is totally it depends on your project need, You can also consider #Habitat and Helix structure for the reference.

Let's design the first template here.

Add a new template, here you will get the option to create a new or choose based on the existing.


Tip#4 Before  Never user Sitecore standard template directly to your side, it should be first driven to the base temple and your base template should be used for the base template, this will always be a good practice, will discuss pros and cons in advance section.

Select the location where you want to store the template. Click Next to create the template.



Add section and fields in the template




Field types details-

All field type details are available here:- https://sdn.sitecore.net/Articles/Media/Referencing%20Binary%20Items/Field%20Types.aspx

Tip#5 - Define Title name, display name, and breadcrumb in a separate field, As some time item name may be different from these fields, Default setup these fields value through the tokens.

Tip#6 - Avoid using heavy field type like RTE, this may affect the load time for the content

 Tip#7 -  Use icon for the template

Details around builder, inheritance, and content.



Inheritance section.



Choose icon

Updated icon-

This icon field and other related fields get stored in the content section,



There are other sections in the standard template like security and statics those are very helpful to quickly review access control and track audit.

 Tip#8 -  How to move section positions- this needs to be done through the tree node.


Now, We have created a template - let's understand the other settings while defining the fields.

Shared: If this is checked then the same value will occur for every numbered version in all supported languages. 
Unversioned: If this is checked, the field has the same value for every numbered version within a language.

Setup standard template here, this is very useful to define some rules like tokes.( tokes are nothing but predefined setup at field level so that will automatically get value assigned based on the user inputs)/.




How to define - Click on the standard template and assign the below token based on the needs


  1. $name: The name for the new item entered by the user
  2. $id: The ID of the new item
  3. $parentid: The ID of the parent of the new item
  4. $parentname: The name of the parent of the new item
  5. $date: The system date in YYYY-MM-DD format
  6. $time: The system time in HHmmss format
  7. $now: The system date and time in yyyyMMddTHHmmss format



Branch template-

Use this feature wherever it's required that if every time an item gets created there is some predefined values to fill in.





No comments:

Post a Comment