Easy property inheritance in Optimizely CMS

blog header image

Ever needed a way to inherit property values down through the page hierarchy in Optimizely CMS 12? Now there is an easy way to enable that.

Ever since the good old Dynamic Properties were phased out of Episerver, I've often missed a way to have a property value inherit down through the page tree. 

Both from me (and others) this has led to various solutions (2).

But - somehow most of them has lacked a few things. For example, they'd typically require a bunch of code to get running. And often there would be little to know editor experience - making them work in a way that's hard for editors to understand and predict.

Now, we (myself and the great Grzegorz Wiechec) have launched an open source add-on called "CodeArt.Optimizely.PropertyInheritance".

Once you have installed the add-on and registered it in Startup (as you usually do), all you have to do is simply add an "[Inherit]" attribute to any property to make it inherit from a parent page, if it's not set. And with a nice editor indication if the value is currently being inherited!

Like this:

    [Inherit(InheritIfNullOrEmpty = true, SearchAllAncestors = true)]
    public virtual string Area { get; set; }

 

And this is how it looks like:

 

Feel free to contribute to the project on github - and leave a comment below if you like it!

And as usual - you can find it in the Optimizely Nuget feed!

 

 

Recent posts