O'Reilly logo

Umbraco User's Guide by Paul Sterling, Nik Wahlberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ORGANIZING TEMPLATES FOR REUSE

Chapter 4 focuses on the creation and management of the templates themselves. This section discusses the practical application of those templates and how managing templates correctly can make for a very flexible presentation engine.

In most cases a document type has a one-to-one relationship with a template. By default, this is the case when you create a document type and elect to have a template created as part of the process. What you may not know is that any given document type can have any number of associated templates, as shown in Figure 8-4.

FIGURE 8-4

image

Several reasons exist for this feature:

  • A document type may support different types of output based on media type or device type.
  • A node's content may need to have the flexibility to be presented differently without having to recreate the content using a different document type.
  • Features of a page may need to be toggled by an editor, such as the inclusion of second-level navigation, a sidebar, or other content.
  • A multi-site environment, as in Chapter 6, needs to have different templates based on the site that is being rendered.

So, when you create your templates, make sure to take into account the various page types that they need to support. One example of when to share a document type with two templates is for toggling a feature of a page. To illustrate the point, follow these steps:

  1. Log ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required