0

I have a template for the details view of a single product. In this template it lists the "tags" and "categories" with links to view products of the same tag or category.

I define the links for the tags and categories in the same way but they are rendered differently.

here is my template:

<link rel="stylesheet" href="@App.Path/assets/portfolio.css" data-enableoptimizations="bottom"/>
<div class="sc-element">
    <div class="ks-portfolio-detail">
        <div class="row">
            <div class="col-sm-12 col-md-6">@Edit.Toolbar(Content)
                <img src="@Content.Image" alt="@Content.UrlKey" class="img-responsive" />
            </div>
            <div class="col-sm-12 col-md-6">
                <div class="ks-title"><h1>@Content.Title</h1></div>
                ...
                <div class="ks-lable">Categories:</div>
                @{ int count=0; }
                @foreach(var item in AsDynamic(Content.Categories)){
                    count++;
                    <a href="@Link.To(parameters: "category=" + @item.Title)" title="@item.Title">@item.Title</a> 
                    @(count < Content.Categories.Count?" | ":"")
                }
                <br/><br/>
                <div class="ks-lable">Tags:</div>
                @{ int counter=0; }
                @foreach(var item in AsDynamic(Content.Tags)){
                    counter++;
                    <a href="@Link.To(parameters: "tag=" + @item.Name)" title="@item.Name">@item.Name</a>  
                    @(counter < Content.Tags.Count?" | ":"")
                }
            </div>
        </div>
    </div>
</div>

Please note the lines where the category and tag links are created:

<a href="@Link.To(parameters: "category=" + @item.Title)" title="@item.Title">@item.Title</a>
...
<a href="@Link.To(parameters: "tag=" + @item.Name)" title="@item.Name">@item.Name</a>

PROBLEM

The tags Link.To renders the link with "slashes" like:

http://dnn804/portfolio/tag/Demo2

but the category renders the link like:

http://dnn804/portfolio?category=Flowers

QUESTION

Can someone help me figure out why these links are rendered differently when using the same function? I want them both to appear like the "tags" link.

Thanks in advance.

J King
  • 4,108
  • 10
  • 53
  • 103

1 Answers1

1

The Link.To uses the DNN-internal link resolution. I'm just going to guess that there are some terms that DNN maybe treats differently, causing special links. DNN does sometimes do strange things with links, just like on the home page, which is why we are using it. That's just a guess though.

You could run some experiments like "cat=" instead of category, to validate this.

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • Yeah. Thanks. I changed the term to categories and it worked. That was good enough for me. It's nice to know possibly why that was happening. It makes sense about dnn treating specific keywords differently. – J King Apr 13 '17 at 14:58