Copied to clipboard

Flag this post as spam?

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


  • Julien Kulker 75 posts 427 karma points c-trib
    Oct 13, 2020 @ 09:57
    Julien Kulker
    0

    What is the correct way to get IpublishedContent filtered by tag

    Hi all,

    What is the correct way to get all content tagged by a specific tag(Multiple).

    I am using umbraco version and this is what i have now.

    foreach (var tag in currentNewsPage.NewsItemType)
        {
            var taggedEntities = tagservice.GetTaggedContentByTag(tag, "News", System.Globalization.CultureInfo.CurrentCulture.Name);
            if (taggedEntities == null || taggedEntities.Count() == 0)
            {
                return;
            }
    
            entities.AddRange(taggedEntities.);
        }
    

    It will return an entity id with the specific tag found. In the documentation i found: .TagQuery.GetContentByTag(string tag, [string tagGroup])

    doesn't seem to exist no more? So the question here is how to implement a peace of code that will get me all published content with a certain tag?

Please Sign in or register to post replies

Write your reply to:

Draft