Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Osman Coskun 170 posts 404 karma points
    Aug 17, 2016 @ 13:46
    Osman Coskun
    0

    Sample code to render tags

    Thanks for the handy tool. Can you please provide a sample razor code to render the tags for a document.

    Thanks in advance.

  • Jason Espin 368 posts 1335 karma points
    Oct 04, 2016 @ 14:59
    Jason Espin
    1

    Hi Osman,

    If you want to render the tags for the current document then you can user the following code:

    var tags = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("aliasOfTagProperty");
    

    You can then loop through the associated pages and list out the tags (and links if you wish) using a standard foreach loop:

    @foreach(IPublishedContent tag in tags){
        <li class="tag"><a href="@tag.Url">@tag.Name</a></li>
    }
    

    This should work with the latest version of Tagliatelle as I added property value converter support.

  • Osman Coskun 170 posts 404 karma points
    Oct 05, 2016 @ 17:22
    Osman Coskun
    0

    Thanks Jason.

  • 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.

Please Sign in or register to post replies