I have been trying to create a blog using Umbraco v6 using Razor.
This is my first Umbraco project so I am still getting to grips with things but I have managed to get most of it working how I want but I would like to list tags in a side widget.
So far I have this -
@{
var blogitems = Umbraco.Content("1188").Children.Where("Visible");
foreach(var blog in blogitems) {
var tagsplit = blog.tags.Split(',');
foreach(var tag in tagsplit) {
<li>
<a href="/blog/?@tag">@tag</a>
</li>
}
}
}
The problem is this lists all tags duplicating many of them. I have tried to use .Distinct on the tagsplit variable which just returns an error.
Any ideas?
.Distinct()
should work, but since it's not, a quick and dirty solution is: