Copied to clipboard

Flag this post as spam?

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


  • Kyle 24 posts 63 karma points
    Feb 26, 2014 @ 13:48
    Kyle
    0

    TagService Umbraco 7

    Hi,

    I've been stuck for a bit now trying to find the new alternative for:

    umbraco.cms.businesslogic.Tags.Tag.GetDocumentsWithTags(tags);
    

    This works perfectly it provides me with a list of ID's with the same tags as the current page. I can still use this method but I would like to know the new way :).

    I've seen the new TagQuery helper but can't see the equivalent method.

    Thanks,

    Kyle

  • Kyle 24 posts 63 karma points
    Aug 19, 2014 @ 16:24
    Kyle
    2

    Not sure if anyone else had this problem but it seems to be there in 7.1.4

    Umbraco.TagQuery.GetContentByTag("tags,here")
    

    Kyle

  • bob baty-barr 1180 posts 1294 karma points MVP
    Jan 23, 2015 @ 23:18
    bob baty-barr
    3

    I am going to post this here... but also try to put it in the wiki or docs or wherever...

    here is a code snippet using the tagservice.

    var tagsFromService = UmbracoContext.Application.Services.TagService.GetAllContentTags("tagGroup");
    @foreach(var tag in tagsFromService) {
    @tag.Text(@tag.NodeCount)
    }
    
    
  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jun 14, 2015 @ 20:33
    Jeavon Leopold
    0

    Hello, I just came across this post while searching for a different thread but I have just started a documentation page for Tags here, would love loads more examples using the TagService....

    Jeavon

  • Lee 1130 posts 3088 karma points
    May 09, 2016 @ 11:13
    Lee
    0

    What about efficient paging?

    UmbracoContext.Application.Services.TagService.GetTaggedContentByTag("Category1").Select(x => x.EntityId);
    

    This just gets everything... What if you have 10K+ of content with a specific tag.

  • Lars Gyrup Brink Nielsen 6 posts 76 karma points
    May 31, 2016 @ 17:41
    Lars Gyrup Brink Nielsen
    0

    Paging is something like this:

    string tag = "Category1";
    int pageSize = 10;
    int pageNumber =  3;
    int pageIndex = pageNumber - 1;
    
    UmbracoContext.Application.Services.TagService
        .Select(x => x.EntityId)
        .GetTaggedContentByTag(tag)
        .Skip(pageIndex * pageSize)
        .Take(pageSize)
        .ToList();
    
  • 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