Skip to content

Instantly share code, notes, and snippets.

@csharpforevermore
Last active May 12, 2020 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csharpforevermore/0add1022146dbd68dbc440f800da90df to your computer and use it in GitHub Desktop.
Save csharpforevermore/0add1022146dbd68dbc440f800da90df to your computer and use it in GitHub Desktop.
Umbraco 8 - output "Tags" backoffice Data Type values. Description: How to output the value of a Tag data type in the View in Umbraco 8 (using both Model Builder version and non-MB version).
@if(!string.IsNullOrEmpty(Request["debug"])){
if(Model.GetProperty("tags") !=null){
<ul>
@foreach(var tag in Model.GetProperty("tags").Value<IEnumerable<string>>()){
<li>@tag</li>
}
</ul>
}
}
@if(Model.Tags.Any()){
<ul>
@foreach(var tag in Model.Tags){
<li>@tag</li>
}
</ul>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment