On my HomePage document type I've created a 'site settings' tab, and within this tab I've added a 'postAuthor' property.
On the HomePage I can retrive and show the 'postAuthor' value using @Model.Value("postAuthor").
But, when I use @Model.Value("postAuthor") on the post page, no value is returned?
Below is the content structure, and I would like to use the global value for the author name from the HomePage 'site settings' tab on other pages below the root node?
I've tried different ways, but still cant get thos to work !
I do not use this feature myself, so cant comment on how effective it is, but doesn't Umbraco have a fallback option, when getting a model value? I noticed when I was playing around with the template editor UI:
Global Settings
Hi,
I'm trying to set/access a global site value.
On my HomePage document type I've created a 'site settings' tab, and within this tab I've added a 'postAuthor' property.
On the HomePage I can retrive and show the 'postAuthor' value using @Model.Value("postAuthor").
But, when I use @Model.Value("postAuthor") on the post page, no value is returned?
Below is the content structure, and I would like to use the global value for the author name from the HomePage 'site settings' tab on other pages below the root node?
I've tried different ways, but still cant get thos to work !
Hi!
You need to get the model for the HomePage node, on your post page, since the properties are defined on it.
Try
Model.Root().Value("postAuthor")
orModel.Root<HomePage>().PostAuthor
if you're using the model builder.Thanks Johan,
This worked perfectly for what I needed.
I do not use this feature myself, so cant comment on how effective it is, but doesn't Umbraco have a fallback option, when getting a model value? I noticed when I was playing around with the template editor UI:
In your case, it would give you:
Seems neat.
is working on a reply...