tagging in umbraco 4.11 just like stackoverflow

678 views Asked by At

im using snipper tag system and following below article:

http://daniel.streefkerkonline.com/tag/umbraco/

i can install and use snipper tag system successfully. but when i browse the page..tags appear as text and not hyper link...

Am i'm missing something. IS it some javascript file or im missing some step to include tags?

Any ideas? here is my page: http://www.leezardpharma.com/pharmacy/our-products/weight-loss-medicine/gastro1.aspx

here relevant tags are coming becuase of snipper ..but they arent clickable.

3

There are 3 answers

0
agrath On

I wrote the sniper tagging control.

If you want friendly URLs for the tags, Create a rewrite rule to map /tags/([\w]*) rewrite to tagsearch.aspx?tag=$1 Then implement tagsearch.aspx to take that tag parameter and return any pages containing it as explained above.

1
Daniel.S On

You sure you're doing this?

<ul>
  @foreach (var node in matchingNodes)
  {
    dynamic dn = new DynamicNode(node.Id);

    <li><a href="@dn.Url">@dn.Name</a></li>
  }
</ul>

Something doesn't look right here, where you're displaying your tags: enter image description here

Where are those two links coming from?

There's no javascript or anything fancy needed. This is all done in razor on the server-side.

1
Ankur Ghelani On

If you need to create tags as link with option to display the products which are tagged then you can create new page called ../search.aspx?tag=tagname and then search for the products which are in that TAG, code is as below:

@inherits umbraco.MacroEngines.DynamicNodeContext
@using System.Text
@using umbraco.MacroEngines
@using umbraco.cms.businesslogic.Tags

@{   
    string searchFor = Request["tags"];

    if(string.IsNullOrEmpty(searchFor))
    {
        @* No tags were specified *@ 
        <p>Please specify a tag to search for</p>
        return;
    }

    // this is to search from the tags added and then get all the nodes
    var matchingNodes = Tag.GetNodesWithTags(searchFor).ToList();

    string tagsText = searchFor.Split(',').Count() > 1 ? "tags" : "tag";

    if (matchingNodes.Count < 1)
    {
       @* No results were found for the specified tags *@ 
       <p>No tagged items were found that matched the @tagsText: @searchFor</p>
       return;        
    }

     @* Some results were found for the specified tags *@ 
     <p><strong>@matchingNodes.Count</strong> products were found that matched the @tagsText: "@searchFor"</p>

      <ul>

      // go through the code and create URL for that product
      @foreach (var node in matchingNodes)
      {
        dynamic dn = new DynamicNode(node.Id);

        <li><a href="@dn.Url">@dn.Name</a></li>
      }
      </ul>
}

you can refer to this article as I have checked it click here and half way down you will see this code

Let me know any more explanation need. I have commented this so that you can get briefing of the code.