Skip to content

Less C# in your Razor, more HTML

Our Umbraco TagHelpers is a community package of ASP.NET Core tag helpers for Umbraco CMS. Translations, member-only content, responsive images, inline SVGs and more, written as HTML. One NuGet package for Umbraco 16, 17, 18 and 19.

Add the package to your Umbraco website project:

Terminal window
dotnet add package Our.Umbraco.TagHelpers

Then register the tag helpers at the bottom of Views/_ViewImports.cshtml:

@addTagHelper *, Our.Umbraco.TagHelpers

Tag helpers turn Razor logic into attributes and elements. This link only renders when the content picker has a value, and so does the image inside it:

Before
@if (Model.ContentPickerThing != null)
{
<a href="@Model.ContentPickerThing.Url()" class="btn">
<span>@Model.ContentPickerThing.Name</span>
@if (Model.LinkMediaPicker != null)
{
<img src="@Model.LinkMediaPicker.Url()" />
}
</a>
}
After
<a our-if="Model.ContentPickerThing != null" href="@Model.ContentPickerThing?.Url()" class="btn">
<span>@Model.ContentPickerThing?.Name</span>
<img our-if="Model.LinkMediaPicker != null" src="@Model.LinkMediaPicker?.Url()" />
</a>

Our Umbraco TagHelpers is a community project: the tag helpers, fixes, tests and these docs come from people across the Umbraco community.

  • Andy Boot
  • Chriztian Steinmeier
  • David Peck
  • Marc Goodson
  • Matthew-Wise
  • Nik
  • Paul Seal
  • Rachel D
  • Richard Thompson
  • Søren Kottal
  • Steven Hart
  • Warren Buckley

Meet the contributors, or find out how to join them.

A community project for Umbraco, open source under the MIT licence.