I created a root content node for meta data (title, description etc). I now need to access these properties from within the master.cshtml - I went through the options in Model but cannot seem to find how to obtain the data. I assume it's a Parent / Root of the page model - Any advice?
j
Jemayn
11/08/2023, 8:12 AM
Assuming a structure like this:
- Site rootnode
-- Homepage
-- Articles
--- Article
- Settings
And you want to access settings from the master template from any child node of the Site rootnode you could traverse to that and then get its sibling.
Copy code
csharp
var site = Model.AncestorOrSelf<ContentModels.Site>();
var settings = site?.Siblings<ContentModels.Settings>().FirstOrDefault();