Copied to clipboard

Flag this post as spam?

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


  • Hundebol 167 posts 314 karma points
    Mar 14, 2017 @ 12:04
    Hundebol
    0

    Render Tags datatype in Nested Content

    Hi umbracians,

    I am using the Tags datatype inside Nested Content. I found out, that this datatype needs to be saved in JSON in order to work properly.

    But - now I am having trouble rendering the actual tags.

    Normally i do like this:

    @if (item.HasValue("tags"))
    {
        var tagList = item.GetPropertyValue("tags").ToString().Split(',');
    
        foreach (var tag in tagList)
        {
        <p>@tag.ToLower().Replace(" ","-")</p> 
        }
    }
    

    But, this just gives me the following:

    [ 
        "john-deere", "mitsubishi" 
        ]
    

    So, the question is - what do i need to do, in order to get rid of the brackets and stuff

    thanks in advance!

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Mar 14, 2017 @ 12:25
    Lee Kelleher
    103

    Hi Hundebol,

    Unfortunately, it's a known issue, the Tags property-editor isn't compatible with Nested Content, (although, I do need to update our README file).

    We have the same issue with the DocTypeGridEditor, which has more details here: https://github.com/umco/umbraco-doc-type-grid-editor/issues/43#issuecomment-204449110

    Ultimately the Tags property-editor has been designed to be used once per page/node. (As it also stores the node ID in another database table, (cmsTags)).

    Furthermore, the code that prepares the Tags value for the database is quite different to other property-editors. There's more info on the issue tracker about this: http://issues.umbraco.org/issue/U4-8279

    There's not much we can do to support Tags within Nested Content.

    Cheers,
    - Lee

  • Hundebol 167 posts 314 karma points
    Mar 14, 2017 @ 12:38
    Hundebol
    0

    Hi Lee,

    Thank you for such a thorough answer!

    Too bad it's not supported - but on the plus side, because of this great answer, I now know WHY it's not supported.

    Thanks again and have a great day.

    best regards :)

  • 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