Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a property on all document types headline and right now it is used in redundant code in two (could be more) view files:
Meta data partial view:
<title>@(Model.Value<string>("headline") != "" ? Model.Value("headline") : Model.Name)</title>
Different template views:
<h1>@(Model.Value<string>("headline") != "" ? Model.Value("headline") : Model.Name)</h1>
I am now trying to extend the Model so I can use Model.Value("PageTitle) / Model.PageTitle instead.
But I must admit that I can´t find out. I have done a lot og Razor in views, but not yet worked with my own custom classes i .NET nor Umbraco.
One thing I have found out, though: This doesn´t work (and also seems to be tied up on only the SiteHome document type)! :)
public partial class SiteHome
public string PageTitle
return Model.Value<string>("headline") != "" ? Model.Value("headline") : Model.Name;
You 'used' to be able to specify a base class for all your generated Modelsbuilder Models:
But I think this may have been removed from the Core version of Umbraco in version 8.5, and in order to do this you may require the external plugin:
Thanks. Can you point me in a direction with some code? I am newbie in working with classes. 🙂
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted