Getting to Grips with Umbraco Templates (.Net master
Umbraco Templates are the glue that pull together and define how
content is going to be presented to visitors. Under the
properties tab, Umbraco Documents select the template to be used
(restricted to the list defined for their Document Type).
When the page is requested, the selected Template combines
content from the document (web page) being called, along with other
sources of content (e.g. macros or other child documents) and
renders the page.
It is perfectly possible to have a flat set of templates, all
driving different pages of the site, however, to maintain a
consistent feel, a lot of copying and pasting would be required.
The simplest of change like a navigation update (hard coded)
or a simple include of a new site wide stylesheet would require
updating each template individually.
To allow a maintainable site, Templates can be nested.
This means that some content is defined at the highest level,
a little more at the next level etc etc. An example of this
would be to define your header and bottom of your page (logo,
navigation, legal links etc) at the highest level, then have a
number of different Templates for different types of pages at the
Template Content and Contentplaceholder Tags
So we now know that Templates pull the content together and that
you use nested templates to build up your page. Now we answer
Contentplaceholder (<asp:contentplaceholder) tags define
areas of a master page / template were you would like content
defining in the child template and Content (<asp:content) tags
define the content in the child master page for it's parent.
level 1 master page:
level 2 child master page:
This is my content
It is worth noting that the child page does not have to define
content for a place holder in it's parent, so it is safe to put a
place holder their if you suspect their may be call for it
It is also worth knowing that you can put default content in the
place holder which will be used if not defined in it's child.
This may be useful in scenarios which you normally output one
thing, but on a couple of pages you would like to do something a
This is content which will be output
unless overridden in one of my children.
To see an example of breaking down someone else's Template (e.g.
when you have installed a 3rd part Umbraco package), see
our Integrating uBlogsy