Property Tag Helper

The property tag helper renders a content property value inside an html element. The tag helper adds some convenience attributes that are not available when rendering the property value directly. The tag helper can also be used with other (non Redakt) properties.


The property tag helper can be applied to any html element by adding the re-property attribute. The property value will then be rendered inside the element. The following attributes can be used:

  • re-property required - the property value to render. This should be the actual property value, not the name of the property. For non string values, the output will be equivalent to calling .ToString() on the value.
  • re-default-value optional - the default value for the property which will be rendered if the property is empty.
  • re-default - the action to take if both the property and the default values are empty. The following options are available:
    • DefaultAction.None default - do nothing; any pre-existing element content will still be rendered.
    • DefaultAction.ClearContent - clears any content that may already exist inside the element.
    • DefaultAction.RemoveTag - completely removes the element from the output.
  • re-content - the action to take if the element already has content. The following options are available:
    • ContentAction.Replace default - replaces any pre-existing element content with the property value.
    • ContentAction.Prepend - prepends the property value to any pre-existing element content.
    • ContentAction.Append - appends the property value to any pre-existing element content.
    • ContentAction.LeaveExisting - leaves the existing content in place, i.e. does not render the property value.


    <span re-property="@Model.Content.Title" re-default-value="@Model.Content.NavTitle">Fallback Title</span>

    <p re-property="@Model.Content.IntroText" re-default="DefaultAction.RemoveTag"><p>
    <p re-property="@Model.Content.IntroText" re-default="DefaultAction.ClearContent" re-content="ContentAction.Append">This is the intro:<br/><p>

    <label re-property="@Model.Content.LabelText" re-content="ContentAction.Prepend"> label</span>

    <div re-property="@Model.Content.FallbackValue" re-content="ContentAction.LeaveExisting">@SomePriorityValue</div>

    <p re-property="@Model.Content.IntroText" re-content="ContentAction.LeaveExisting">@SomePriorityValue</div>