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?
- Navigation (Menu)
- Search box
- Language selector
- 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.
- Go to Sitecore (http://learningsitecore/sitecore)
- Enter your credentials (admin/b).
- Select Content Editor application on the launchpad
- Expand Templates in the Content tree.
- So there are some ready templates for you under Templates node but now we will create one custom template.
- Right click on User Defined >> Insert >> New Template.
- Name it ‘MenuItem’ and click on Next
- Again click on Next and then click on Close.
- You should be able to see a new screen to create template.
- The template consists of field section, field title/name and type. So Ill explain each one by one.
- Now we know that for Link we need one title field and one link so lets create it.
- 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.
- There are various field types provided to us by Sitecore.
- Each field type has it’s own importance, I will write my next blog on field types.
- To your surprise, we are done with creating template. Now we need to create content out of it.
- Go to Home node (/sitecore/content/Home), right click and select Folder.
- Name this Folder as Navigation.
- Start entering Menus (Home, About, Services, Contact us) for now link we can leave blank except for home and About node.
- Right Click on Navigation >> Insert >> Insert from template.
- Select the MenuItem template and enter the name of the template in Item Name field.
- Click on Insert.
- 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.
- Now in the title field enter the name of the field that is Home and in the link field, click on Insert link.
- In the screen, navigate to Sitecore/Content/Home and click Insert.
- Save the changes.
- Similarly add About, Services, and Contact us but we can keep the link field empty.
- Now all the item got arranged in alphabetically order. But we need it in the order (Home, About, Services and Contact us)
- Select Home and click on First.
- 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.. 🙂