What is template and how to create it?

From this blog, we will start touching sitecore’s basic building blocks. So first thing we need to create or build is a template without which we can not have our content in Sitecore.

There 3 common types of template – Data, Parameter and Branch templates. The most common is Data template which will be covered in this blog. Rest we will study as the series progresses.

Now lets consider Header, to create the content what all things we need?

  1. Logo
  2. Navigation (Menu)
  3. Search box
  4. Language selector
  5. Whatever other you want to add.

Now for more simplicity, we will consider Menu. To create a Menu, we need Title (title of the Menu option) and Link (The link on which we will be redirected to).

So lets create a data template for the Menu and then create a content out of it.

  1. Go to Sitecore (http://learningsitecore/sitecore)
  2. Enter your credentials (admin/b).
  3. Select Content Editor application on the launchpad
  4. Expand Templates in the Content tree.
  5. So there are some ready templates for you under Templates node but now we will create one custom template.
  6. Right click on User Defined >> Insert >> New Template.
  7. Name it ‘MenuItem’ and click on Next
  8. Again click on Next and then click on Close.
  9. You should be able to see a new screen to create template.VS9
  10. The template consists of field section, field title/name and type. So Ill explain each one by one.
  11. Now we know that for Link we need one title field and one link so lets create it.
  12. In our example of a template, the Basic Details is Field section. Title & Link are field names. Title is of field type “Single-Line Text” and Link is of type “General Link”. Once you have added this, click on Save.
  13. There are various field types provided to us by Sitecore.
  14. Each field type has it’s own importance, I will write my next blog on field types.
  15. To your surprise, we are done with creating template. Now we need to create content out of it.
  16. Go to Home node (/sitecore/content/Home), right click and select Folder.
  17. Name this Folder as Navigation.
  18. Start entering Menus (Home, About, Services, Contact us) for now link we can leave blank except for home and About node.
  19. Right Click on Navigation >> Insert >> Insert from template.
  20. Select the MenuItem template and enter the name of the template in Item Name field.
  21. Click on Insert.
  22. You will be able to see to sections for the Home Item, Quick Info and Basic Details. Basic Details section is the one we created and Quick Info is provided by the Sitecore platform to us and specifies the details of the respective item namely path, id and author.
  23. Now in the title field enter the name of the field that is Home and in the link field, click on Insert link.
  24. In the screen, navigate to Sitecore/Content/Home and click Insert.
  25. Save the changes.
  26. Similarly add About, Services, and Contact us but we can keep the link field empty.
  27. Now all the item got arranged in alphabetically order. But we need it in the order (Home, About, Services and Contact us)
  28. Select Home and click on First.
  29. Select Services and click on Up.

This completes our task of creating custom template and creating content out of it.

In the next blog, we will learn different types of field types provided by Sitecore.

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

4 thoughts on “What is template and how to create it?

  1. Pingback: How to resolve the error related to System.Web.Mvc dll version | Sitecore Dairies

  2. Pingback: Designing templates – the Information Architecture. | Sitecore Dairies

  3. Wow that was strange. I just wrote an really long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say wonderful blog!

    Liked by 1 person

  4. Pingback: What is Branch Template? And where do we use it? | Sitecore Diaries

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s