Copied to clipboard

Flag this post as spam?

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


  • Kim Rasmussen 81 posts 310 karma points
    Aug 16, 2012 @ 10:20
    Kim Rasmussen
    0

    Retrieve nodes by tags with spaces

    Hi friendly forum!

    I saw this post regarding tags and Razor: http://our.umbraco.org/forum/developers/razor/22902-Tags-example

    But my problem is with tags with spaces, 'Tag with spaces'. The querystring is:

    timeline.aspx?tag=Tag%20with%20spaces

    @{
       
    string tagToFind = Request.QueryString["tag"];
       
    var allNodesWithTags = Model.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\"");
    }

    @foreach (var node in allNodesWithTags)
    {
       
    string[] tags = node.tags.ToString().Split(',');
       
       
    if (tags.Contains(tagToFind))
       
    {
               
    <a href="@node.Url">@node.Name</a><br />
       
    }
    }

    Umbraco 4.8

    Best regards!
    Kim

  • 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