Copied to clipboard

Flag this post as spam?

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


  • Robert 63 posts 282 karma points
    Dec 17, 2014 @ 17:44
    Robert
    0

    Display tags

    Hi,

    I have an tab in Umbraco 7.2 with two types of tags, actieBlokLinks and actieBlokRechts, with different tags.

    How can i manage to get them display on my website?

    Kind regards,

    Robert

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Dec 17, 2014 @ 18:31
    Jan Skovgaard
    1

    Hi Robert

    You should be able to fetch the tags by using Razor.

    You could for instance write @Model.Content.GetPropertyValue("alias") in the template, or partial view macro where you want to fetch the tags. You need to replace the "Alias" part with the property editor alias you use on your document type of course.

    Hope this helps.

    /Jan

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Dec 17, 2014 @ 19:07
    Dennis Aaen
    102

    Hi Robort,

    Try to see this documentation for the tags property editor, http://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors/Tags And since you are using Umbraco 7.2, you could choose to use the strongly typed version.

    @{
        if (Model.Content.HasValue("articleTags"))
        {
            <ul>
            @{
                String[] articleTags = Model.Content.GetPropertyValue<String>("articleTags").Split(',');
                foreach (var item in articleTags)
                {                  
                    <li>@item</li>   
                }
            }
            </ul>             
        }  
    }

    Or the dynamic version.

    @{
        if (CurrentPage.HasValue("articleTags")){
            <ul>
            @foreach (var tagItem in CurrentPage.articleTags.Split(','))
            {
                <li>@tagItem</li>
            }
            </ul>
        }  
    }    

    Rember to replace the articleTags with the property editor alias you use on your document type as Jan said.

    Hope this helps,

    /Dennis

  • Robert 63 posts 282 karma points
    Dec 18, 2014 @ 08:50
    Robert
    0

    Yes, thank you! That helped me out. Both options work, i will read the documentation to see the difference between those 2.

    Kind regards, Robert

  • William Charlton 171 posts 218 karma points
    Jun 24, 2016 @ 12:17
    William Charlton
    0

    Robort, I could not get the dynamic version to work but the strongly typed on was OK.

    What I am looking for is some way to display ALL my tags as a clickable Tag cloud as I did using Snipersystems excellent tag manager on http://www.etymonda.com/resources/books.aspx I am running Umbraco 7.2 so am using Tagmanager - some heads up on using that would be good too; the current documentation is a bit sparse.

Please Sign in or register to post replies

Write your reply to:

Draft