When we create any new site, we don't want to have to duplicate the header, footer, includes to the stylesheets and javascript files on every page.  Instead, it is a much better approach to creating a global template that we can easily include in all our templates.  In today's guide, we will cover how to do this.

Creating The Master View

Create a master view/template in an Umbraco site is exactly the same as how you would do it in MVC.  To set a default layout to use, we need to create a file called '_ViewStart.cshtml' that lives in your webroots view directory.  In your _viewStart you need to create a pointer to the file that will define your global style:

Next, we need to create the layout file, in Views/Shared create a view called '_Layout.cshtml'.  In the layout file, you are then free to style your website however you want.  In my example, I'm going to continue on from, How To Use MVC Partials In Umbraco and create a layout that includes a reference to the header partial created in that tutorial:

The next step is to set our template to use the layout.

Now, when you view the page in a browser, the MVC pipeline will combine all the different elements together in order to render the page.