Our-Umbraco-TagHelpers
Our-Umbraco-TagHelpers copied to clipboard
Added an `our-tag` tag helper
our-tag
This tag helper attribute can be seamlessly integrated with any DOM element within the Razor file. It allows content editors to oversee SEO by designating the appropriate HTML tags for distinct elements. Consider a scenario where you have an item in your block list named 'Heading Tag' - maybe it's from a predefined dropdown? This is saved as a straightforward string. Your block view then fetches this value through the model, making it accessible for the 'our-tag' tag helper.
Example 1
// Model.Heading = "This is my heading"
// Model.HeadingTag = "H1"
<h2 class="my-heading" our-tag="@Model.HeadingTag">@Model.Heading</h2>
Output
The hardcoded h2
has been replaced with an h1
element tag.
<h1 class="my-heading">This is my heading</h1>
Example 2
// Model.Heading = "This is my heading"
// Model.HeadingTag = ""
<h2 class="my-heading" our-tag="@Model.HeadingTag">@Model.Heading</h2>
Output
Defaults to the original hardcoded element tag:
<h2 class="my-heading">This is my heading</h2>