Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi!
I've created a property with tags and added a Razor shortcode : @Model.Value("huskeliste") in my template but each tag is being rendered as : System.String[]
I have textareas that work fine.
I'm using version 12.
What's going on?
Thanks in advance.
Thomas
Hi Thomas,
Your tag property will be an IEnumerable list, so render it like this
@if(Model.Huskeliste.Any()){ <ul> @foreach(var tag in Model.Huskeliste){ <li>@tag</li> } </ul> }
see here
https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/tags
The answer from Huw helped me solve the same problem. needed to use the second example in the link. this worked for me.
@{ if (Model.HasValue("keywords")) { string keywordstring = ""; var keywords = Model.Value<IEnumerable<string>>("keywords"); foreach (var keyword in keywords) { keywordstring += keyword + ","; } <meta name="keywords" content="@keywordstring" /> }}
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Tags rendered as systemstring[]
Hi!
I've created a property with tags and added a Razor shortcode : @Model.Value("huskeliste") in my template but each tag is being rendered as : System.String[]
I have textareas that work fine.
I'm using version 12.
What's going on?
Thanks in advance.
Thomas
Hi Thomas,
Your tag property will be an IEnumerable list, so render it like this
see here
https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/tags
The answer from Huw helped me solve the same problem. needed to use the second example in the link. this worked for me.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.