Creating Your First Template
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.
If you do not see the template, try refreshing the page.
Open the template. It contains a little bit of Razor code.
Code Breakdown:
@using Umbraco.Cms.Web.Common.PublishedModels;
- Imports the namespace for Umbraco's strongly-typed content models.@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
- Sets the view to inherit from Umbraco's base view class for accessing Umbraco-specific features and helpers.Layout = "null";
- The view will not use a layout page unless explicitly specified. For more information on Razor Pages Layout, see the Microsoft Documentation.
Home Page Template Paste the template code, while leaving the code that is already there.
We are using the files from the Custom Umbraco Template folder. Clicking the link will automatically download the files to your device.
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 uses Razor that 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.
Creating Your First content node
Our third and final stage to creating our first page in Umbraco, is to create a content node. The content node 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 Content in the tree.
Click Create.
Select HomePage. The Home Page opens in the content editor.
If you cannot see the content node, check that Settings > Document Types > HomePage > Structure > Allow at root is enabled.
Home Page Content Node 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.
Proin eleifend consequat nunc id vulputate.
Ut eget lobortis metus, non congue lorem.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Maecenas tempus non lectus rhoncus efficitur.
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 2024
Click Save and Publish. The content tree will reload with the homepage node.
Home Page in Content Tree
Accessing the Frontend
To view your content on the frontend:
Go to the Info tab in the Homepage content node.
Click on the link under the Links section.
The default Umbraco page is gone and we can see a basic unstyled page. We are getting there.
If you see a blank page, check if the template is entered and remember to save it.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-b86d17b4c1c389cdc8c4d68e4c76d3adc54c4ad8%252Ffigure-16-unstyled-homepage-v8.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=75d960e5&sv=1)
Last updated