Creating Your First Template
Last updated
Last updated
Umbraco creates a corresponding template when you select the Document Type with Template option when creating a Document Type.
To edit the template:
Go to Settings.
Expand the Templates folder in the Templating section of the tree. You should see a template titled HomePage.
Open the template. It will contain a little bit of Razor code. \
Leaving the code that's there (if you don't understand it, don't worry!) let's copy our template code in.
We are using files from the Custom Umbraco Template.
Open the Custom Umbraco Template folder and copy the contents of index.html.
Paste the content into the HomePage template below the closing curly brace "}".
Umbraco Templates use Razor which allows you to add code in your Template files. Razor reacts to @
signs.
Click Save.
We now have a Template. That's two out of the three stages complete for our first page.
Our third and final stage to creating our first page in Umbraco, is to create a content node that uses our Document Type and Template, to serve up an HTML page to web visitors.
To add a content node:
Go to Content.
Select ... next to the Content headline in the tree. Select HomePage. \
If you cannot see the content node, check that [Settings] > [Document Types] > [HomePage] > [Permissions tab] > [Allow at root] is checked. The Home Page opens in the content editor.
Enter the name for the content node. We are going to call this Homepage.
The name will show up in the node list and will be used to create a url for the page. Try to keep it short but descriptive.
Enter the following details:
Name | Description |
---|---|
Page Title | Welcome to Widgets Ltd |
Body Text | Lorem ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam et aliquet ante, ut eleifend libero.
Sed est ligula, maximus in dolor sed, lacinia egestas ligula. Donec eu nisi lectus. Morbi pharetra pulvinar arcu non gravida. |
Footer Text | Copyright Widgets Ltd 2019 |
Click Save and Publish. The content tree will reload with the homepage node.
Refresh your webpage in your browser http://localhost:xxxx. To access your webpage:
In the Homepage content node, select Info.
Click on the window pop-up symbol under the Links section.
The default Umbraco page will now be gone and we'll now see a very bare, unstyled page. We are getting there.
If you see a blank page, check if the template is entered and remember to save it.