Copied to clipboard

Flag this post as spam?

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


  • Chris C 43 posts 184 karma points
    Apr 17, 2013 @ 22:47
    Chris C
    0

    businesslogic.Tags.Tag.GetTags

    Trying to build a tag cloud in Umbraco 6 using Razor macro.  The cloud should show all tags in a specific blog instance. 

    So then I discovered the Tag.GetTags method.  This seems to accept a node id, and returns the tags belonging to that node.  It also accepts a string called group, but not sure what this does.  So is there an Umbraco business logic function to get all the tags for blog posts under a blog node?  Or do I have to do it manually, getting the posts, looping through, building a list of tags and all that?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 18, 2013 @ 00:27
    Tom Fulton
    0

    Hi,

    "Group" maps to the group you set on the Tags datatype (see Developer -> Datatypes -> Tags).  This is useful if you want to use Tags for two different functions on your website (like a Blog and a News section) and have them use a different set of tags.

    As best practice I always set the 'group', even if it's the only one I'm using at the moment - just to make life easier later on.  If you already have a bunch of tags mapped, maybe you can try passing an empty string for the group parameter - or setting it and seeing if that works right away or not.

    I've used Tags.GetTags("blogposts") to generate tag clouds in the past, so sounds like you're on the right track :)

    Hope this helps,
    Tom 

  • Chris C 43 posts 184 karma points
    Apr 20, 2013 @ 08:11
    Chris C
    0

    Hello.  So if I understand you correctly, you're saying I should create separate datatypes for the tags I'm going to use in each blog.  Put a group of "blog1" and "blog2" on the new tag datatypes, and tell my blog post document types to use the corresponding tag datatypes.  Then when I want to generate a tag cloud for one of the blogs I just need to pass in the correct group name?  Or is there a way to set the tag datatype group name when I link it into a document type? 

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 20, 2013 @ 08:23
    Tom Fulton
    0

    Yeah, exactly as you said is the way I would recommend doing it.  Then you can do something like:

    var blogTags = Tag.GetTags("blog1").OrderByDescending(t => t.NodeCount);

    You'll just need to pass in the name you're using for the tag group - there's not really a way to link it up based on the doctype.  Maybe you could create a property on each Blog doctype called "Tag Group" to pull this from.

    -Tom

  • Tri Mandir Prajapati 42 posts 60 karma points
    Oct 23, 2013 @ 09:28
    Tri Mandir Prajapati
    0

    Hi, 

    In backend is there any possibility to move the tags... I mean change the position of tag once it is entered?,

    Thanks for you support, in advance :)

    Regards

    Tri Mandir

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 28, 2013 @ 00:25
    Tom Fulton
    0

    Hi Tri,

    No, it doesn't look like the default Tags datatype supports sorting. There might be some other packages you could use, though.

    Might be worth logging as a feature request on the issue tracker too: http://issues.umbraco.org/

    -Tom

  • Tri Mandir Prajapati 42 posts 60 karma points
    Jan 08, 2014 @ 11:02
    Tri Mandir Prajapati
    0

    Hello Tom

    Thanks for responding.

    -Trimp

Please Sign in or register to post replies

Write your reply to:

Draft