开发者

ASP.NET MVC is ruining my page with duplicate content

I have this page (in danish - sorry) http://www.itilbud.dk, i have an amount of offers in the center, and a numb开发者_如何学Cer of tags (the buttons). When the user clicks a button it should filter the offers using the information for the clicked category.

My problem is that it seems Google threw be back on page 6 from page 3, i think its because when i click my tag buttons, the URL changes but the new page is shown with the same offers, now filtered by the selected category.

From: http://www.itilbud.dk/ To: http://www.itilbud.dk/Home/Index/10

The default route shows the Home/index page, so does the to adress shown above, and its the same data on both (a subset on the home/index page, only filtered by tag number 10)

This is duplicate content, and all i needed was to tell my page to filter on a given tag value.

Can i do it using AJAX or will the call still break duplicate content? since the data will re-appear on the same page.

Anyone got a good idea, its not fun being on page 6 :-(

EDIT Controller code for Index

[HttpGet]
        public ViewResult Index(string id)
        {
            //id is the tag-id
            OfferRepository repository = new OfferRepository();
            ViewData["amountoffers"] = repository.OfferAmount(); //not relevant, used to load the next n offers
            List<Offer> offers = new List<Offer>();
            if (string.IsNullOrEmpty(id))
            {
                offers = repository.LoadAll(0, 100); //max 100 offers
            }
            else
            {
                offers = repository.LoadAll(0, 100, int.Parse(id));
            }
            return View(offers);
        }

The user-control that renders a category button:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%OnlineTilbud.DataAccess.Tag tag = (OnlineTilbud.DataAccess.Tag)Model;
    if(tag.Active)
    {
    %>
<span class="tag">
<%=Html.ActionLink(tag.TagName, "Index", new{Id=tag.Id}) %>
</span>
<%} else { %>
<span class="inactivetag">
<%=Html.ActionLink(tag.TagName, "Index", new{Id=tag.Id}) %>
</span>
<%} %>

Sincerely


I fixed it using AJAX instead for loading all the offers on the page. Now my online offer brochure is working without duplicate content (and running a bit faster when sorting).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜