Canonical rel ="next"?

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Canonical rel ="next"?

Post by kwikstand » Tue Jun 23, 2015 4:09 pm

Does AC support rel ="next" and rel="prev" pagination?

I just watched a Google video that says to avoid using rel="canonical"
Contractor's Solutions
www. contractors-solutions.net

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Canonical rel ="next"?

Post by mazhar » Fri Jun 26, 2015 12:47 am

Currently uses rel=canonical to provide with URL information which is a good and known SEO practice. From your question it seems you are asking with respect to paged data with links? If that video is public perhaps you should shared the URL here.

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: Canonical rel ="next"?

Post by kwikstand » Fri Jun 26, 2015 4:19 am

Yes, I am asking about things like category pages, where you typically have multiple pages of products.

Here is the video: https://www.youtube.com/watch?v=6AmRg3p ... ploademail
Contractor's Solutions
www. contractors-solutions.net

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: Canonical rel ="next"?

Post by kwikstand » Thu Jul 30, 2015 5:11 am

So, I guess AC can't do rel ="next" and rel="prev" pagination.

When I get some time, I will see if I can make it work.
Contractor's Solutions
www. contractors-solutions.net

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Canonical rel ="next"?

Post by Brewhaus » Tue Oct 13, 2015 12:05 pm

Did you ever get this to work? We just had someone go through our website to find all technical aspects that could negatively affect Google ranking, and this is one of the biggest things that they found. I have tried to look at the files to find a way to fix this, but to no avail.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Canonical rel ="next"?

Post by mazhar » Wed Oct 14, 2015 6:45 am

For Category Grid(Deep Item Display) Page this can be tried. First edit ConLib/CategoryGridPage.ascx.cs file and locate following code

Code: Select all

if (PagerPanel.Visible)
                {
                    PagerControls.DataSource = AbleCommerce.Code.NavigationHelper.GetPaginationLinks(currentPagerIndex, totalPages, baseUrl);
                    PagerControls.DataBind();
                }

                if (PagerPanelTop.Visible)
                {
                    PagerControlsTop.DataSource = AbleCommerce.Code.NavigationHelper.GetPaginationLinks(currentPagerIndex, totalPages, baseUrl);
                    PagerControlsTop.DataBind();
                }
and update it like this

Code: Select all

List<PagerLinkData> pages = AbleCommerce.Code.NavigationHelper.GetPaginationLinks(currentPagerIndex, totalPages, baseUrl);
                if (pages.Count > 1)
                {
                    int index = pages.FindIndex(p => p.TagClass == "current");
                    if (index > 0)
                    {
                        PagerLinkData prev = pages[index - 1];
                        Page.Header.Controls.Add(new LiteralControl(string.Format("<link rel=\"prev\" href=\"{0}\">", Page.ResolveUrl(prev.NavigateUrl))));
                    }

                    if (index < pages.Count - 1)
                    {
                        PagerLinkData next = pages[index + 1];
                        Page.Header.Controls.Add(new LiteralControl(string.Format("<link rel=\"next\" href=\"{0}\">", Page.ResolveUrl(next.NavigateUrl))));
                    }
                }
                if (PagerPanel.Visible)
                {
                    PagerControls.DataSource = pages;
                    PagerControls.DataBind();
                }

                if (PagerPanelTop.Visible)
                {
                    PagerControlsTop.DataSource = pages;
                    PagerControlsTop.DataBind();
                }

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Canonical rel ="next"?

Post by Brewhaus » Wed Oct 14, 2015 7:02 am

From what I can find, Google is also happy if there is a 'View All' option, and will use it if it is available. That can easily be added to the CategoryGrid by adding a new 'View All' option with a value of "0".

Code: Select all

<asp:ListItem Text="View All" Value="0"></asp:ListItem>
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: Canonical rel ="next"?

Post by kwikstand » Sat Jul 30, 2016 7:32 am

How do you do it for the NEW Category Grid Page4 ?

I have tried at least several times and it just breaks the page.

It says:

[[ConLib:CategoryGridPage4]] g:\Home\WWW\contract\contractors-solutions.net\wwwroot\ConLib\CategoryGridPage4.ascx.cs(328): error CS0246: The type or namespace name 'PagerLinkData' could not be found (are you missing a using directive or an assembly reference?)
Contractor's Solutions
www. contractors-solutions.net

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: Canonical rel ="next"?

Post by kwikstand » Sat Jul 30, 2016 11:38 am

OK, I think I figured it out. I had to add " using AbleCommerce.Code;" near the top.

Now the problem is, the category pages have BOTH canonical link AND rel=prev / next tags. Google advises against this:
For example, one common mistake people make is that they properly put “rel prev”, “rel next” tags on pages, but also include “rel canonical” tags on the same pages. These two tags conflict with one another, and should not be on the same page as one another.
How is the canonical link tag removed from category pages?
Contractor's Solutions
www. contractors-solutions.net

nadeem
Captain (CAPT)
Captain (CAPT)
Posts: 258
Joined: Tue Jul 31, 2012 7:23 pm

Re: Canonical rel ="next"?

Post by nadeem » Mon Aug 01, 2016 2:27 am

To remove the canonical link from category pages, open Website/App_Code/PageHelper.cs

Locate the following code

Code: Select all

string canonicalFormat = "<link rel=\"canonical\" href=\"{0}\" />";
string objectUrl = storeUri.Scheme + "://" + storeUri.Authority + page.ResolveUrl(catalogObject.NavigateUrl);
objectUrl = objectUrl.Replace("/mobile/", "/");
htmlHead.Append(string.Format(canonicalFormat, objectUrl));
and replace with

Code: Select all

if (catalogObject.CatalogNodeType != CatalogNodeType.Category)
{
    string canonicalFormat = "<link rel=\"canonical\" href=\"{0}\" />";
    string objectUrl = storeUri.Scheme + "://" + storeUri.Authority + page.ResolveUrl(catalogObject.NavigateUrl);
    objectUrl = objectUrl.Replace("/mobile/", "/");
    htmlHead.Append(string.Format(canonicalFormat, objectUrl));
}

Post Reply