I have a news list under which there are a load of News Items. I'm trying to get the page name of the news list to display on each news item but this code isn't cutting it. I get an error saying "Umbraco.Web.Models.RenderModel' does not contain a definition for 'AncestorOrSelf'"
I want this to use levels rather than nodeID so it's reuseble on other pages. This is what I've got so far:-
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "BasePage.cshtml";
var sectionTitle = Model.AncestorOrSelf(2).pageName;
}
<div id="contentHeader">
<div class="row contentHeader">
<div class="col-md-6 page-title no-left-pad">
<h1>@sectionTitle</h1>
</div>
<div class="col-md-6 no-right-pad">
<a href="/care-homes" class="btn btn-care-profile pull-right">Use our CareFinder</a>
</div>
</div>
</div>
@RenderBody()
Any advice appreciated as I can't find any reason for the error anywhere.
Thanks