Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
As an alternative, if you're using a newer version of the CMS and you're after something a bit more front-end friendly, it would be worth considering tag helpers. They can make it a bit more obvious what you're going to get when a property is rendered. For example, to write a heading to a page, you could use PropertyFor() like this:
@Html.PropertyFor(x => x.Heading, new { CustomTag = "h1", CssClass="heading-lv1"})
or you could use a tag helper like this:
<h1 class="heading-lv1" epi-property="Heading" />
You can read about tag helper usage here:
https://docs.developers.optimizely.com/content-management-system/docs/rendering-properties-with-tag-helpers
Our front end has asked for some sort of wrapper/extension method for the Html.PropertyFor() and the likes, that better represent whats being done. My idea is to probably write our own extension method to be used like "@Html.MyExtensionMethod(x => x.CurrentPage.SomeProperty);", but basically has the same logic behind it. It feels a bit cumbersome and not very DRY-friendly. Would there be a better way to go on about this?