Reputation: 183
I would like to share content (essentially blocks of html) between templates.
For example, suppose I have a common footer section with a graphic or two, text and links to 'about us', 'contact us' and so on. I have different templates for different page layouts, but they all require this footer. So far I can think of three ways :
Is any of these the recommended process (and are there any pitfalls?) or is there a better way?
Upvotes: 1
Views: 1083
Reputation: 4257
I would normally do one of the following:
That seems to be fairly standard from most of the Umbraco sites that I've worked on. I wouldn't have all of the properties on each page, unless you need a unique footer each page for some reason.
For example, lets say you add a tab called "Footer Settings" to the Home Page DocType with a single string property with the alias "copyRightNotice" and then you want to display that in a partial, your partial might look something like:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
var rootPage = Model.Content.AncestorOrSelf(1);
<h3>@rootPage.GetPropertyValue("copyRightNotice")</h3>
}
Upvotes: 0