I'm currently setting up my partial views on my master template, like so:
@inherits UmbracoTemplatePage
@{
Layout = null;
IPublishedContent global = Umbraco.TypedContentSingleAtXPath("//*[@nodeTypeAlias='Global']");
}
<!DOCTYPE html>
<html>
<body>
@Html.Partial("Header", global)
@RenderBody()
@Html.Partial("Footer", global)
</body>
</html>
The global node being called contains everything needed for the header and footer to work, namely content-managed logos and navigation. As things stand, this works fine.
However, it feels wasteful to have to declare and pass this global node every time I want to grab global settings. My background is with WebForms so while I could just create a class and call this each time to grab the node I'd like to know of a MVC-type way of handling this.
Does anyone know of a clean way I can merge this declaration into a Model or Controller, so that I can call global settings when needed, without having to declare first and call into my partial views?