Copied to clipboard

Flag this post as spam?

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


  • David Hammer 41 posts 67 karma points
    Nov 27, 2013 @ 07:12
    David Hammer
    0

    Listing Nodes Based on Specific Tag name

    Hello guys..

    I have a question I hope you guys can help me with.

    On my frontpage I have 6 boxes. Each of these boxes links to a new different page.

    The new page is a template called "Focus Article List". In this template i call upon the power of a macro named "Focus Article List" aswell.

    What I want to know is how (in this macro) to list a specific list of articles based on a completely specific TAG name.

    This way I would like the template to render a different list based on which box i choose to press on the frontpage.

    • I'm using Sniper Systems Tag Control

    Here is my code so far:

    var root = Model.AncestorOrSelf(1).DescendantsOrSelf("ArticleArchiveYear").First();
    var selection = root.Children.OrderBy("homepageArticleDate desc");
    
    @foreach (var item in selection) {
        if (item.HasProperty("homepageArticleTags")) {
            foreach (var tag in item.homepageArticleTags){
                if (tag == "happy-go-lucky") {
    

    I believe I'm not very far down the road of how I should approach this. I've tried several things, but none of them works.

    How do I get the macro to react to what kind of parent has been pressed? I mean I have to press a link (box), and then render the template, but how can I get the macro to know which type of /focus article list/ to print?

    Dear Umbraco God, please help me 8)

  • Osman Coskun 170 posts 404 karma points
    Dec 06, 2013 @ 00:09
    Osman Coskun
    0

    Hi i managed to get the nodes with tags using the following code:

    string tagToFind = Request.QueryString["tag"];
    var matchingNodes = Tag.GetDocumentsWithTags(tagToFind);
    
    if(matchingNodes.Count() > 0){
        <span>@matchingNodes.Count() results found for the tags @tagToFind .</span>
        @foreach (var node in matchingNodes) {
            @node.Name
        }
    }else{
        <span>No results found for @tagToFind tags.</span>
    }
    

    However if i try to search for tags that has Turkish specific characters no result returned.

    Any advice?

  • 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