Up until now, items created as Next.js-based samples have been created based on the root item created when importing JSS samples. This time, we will introduce the procedure for creating the equivalent of a root item.
Create a base template
We will be creating a new template so that we can better handle the content structure to be managed on the site in the future. First, we will create a base template. The templates will be created in the following folders
- /sitecore/templates/Project/sitecoredemo-jp
First, create a template folder. Click on the "Template Folder" button to make it the Common folder.
With the created folder in place, click the New Template button. In this case, we will name the template Page. The base template can proceed as the standard template.
As the field item in the Page template, the field section is Content, the pageTitle is Singleline Text, and the pageContent is the RichText field.
Then select the Builder option from the Content Editor menu to specify the base template.
The base template should be Route under Template - Foundation - JavaScript Services.
Save the template once, this time clicking on Standard Values in the Builder Options menu. Complete the Standard Value setup by specifying $name in the Title field.
Next, create a template for metadata. The template name is _Metadata.
As for fields, create a Metadata field section and a field called pageDescription.
Create a template
Now that we have created two base templates, we will go on to create the home template. This time, instead of a folder called Common, we will create a folder called Pages.
Next, we will create the Home template, but we will create it as a standard template.
Specify the above two templates, Page and _Metadata, as the base template.
The home item icon designates an item in the network as shown below.
The root item is now complete.
Create an item
Let's create an item based on the template we have just created. First, right-click /sitecore/content/sitecoredemo-jp in the content tree and select Insert - Insert from Template.
When selecting Insert from Template, specify the Home template you just created. In this case, the item name is Home Test.
You can see that the item has been created and the title contains the item name with $name enabled.
Summary
You can now create a new template to create an item. In this case, we have created a template called `Home`. In the next article, we will proceed to set up and configure the layout to display this template.