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
I'm on Umbraco 7.7.2 with Models Builder enabled. I created keywords for a page based on Umbraco Tags. I would like to render these tag values out to page. On one of my child templates, I have the following logic...
@inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.FFacol1> @using ContentModels = Umbraco.Web.PublishedContentModels; @{ Layout = "Master.cshtml"; } @section Keywords { @{ var mkeywords = Model.Keywords; foreach (var item in @mkeywords) { @item } } }
...But when I look at my page, it shows all my values compacted together like this....
<meta name="keywords" content="value1value2value3value4etc..."
How can I get proper spacing and commas in between each value?
Hi
you can replace the loop with a string.Join command
@string.Join(", ", Model.keywords)
this should output something like,
"Value1, Value2, Value3, ....."
Wow that is super short compared to a foreach loop! It works for me. Thanks!
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
how to properly render tags
I'm on Umbraco 7.7.2 with Models Builder enabled. I created keywords for a page based on Umbraco Tags. I would like to render these tag values out to page. On one of my child templates, I have the following logic...
...But when I look at my page, it shows all my values compacted together like this....
How can I get proper spacing and commas in between each value?
Hi
you can replace the loop with a string.Join command
this should output something like,
Wow that is super short compared to a foreach loop! It works for me. Thanks!
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.