Page 1 of 1
Canonical rel ="next"?
Posted: Tue Jun 23, 2015 4:09 pm
by kwikstand
Does AC support rel ="next" and rel="prev" pagination?
I just watched a Google video that says to avoid using rel="canonical"
Re: Canonical rel ="next"?
Posted: Fri Jun 26, 2015 12:47 am
by mazhar
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.
Re: Canonical rel ="next"?
Posted: Fri Jun 26, 2015 4:19 am
by kwikstand
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
Re: Canonical rel ="next"?
Posted: Thu Jul 30, 2015 5:11 am
by kwikstand
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.
Re: Canonical rel ="next"?
Posted: Tue Oct 13, 2015 12:05 pm
by Brewhaus
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.
Re: Canonical rel ="next"?
Posted: Wed Oct 14, 2015 6:45 am
by mazhar
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();
}
Re: Canonical rel ="next"?
Posted: Wed Oct 14, 2015 7:02 am
by Brewhaus
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>
Re: Canonical rel ="next"?
Posted: Sat Jul 30, 2016 7:32 am
by kwikstand
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?)
Re: Canonical rel ="next"?
Posted: Sat Jul 30, 2016 11:38 am
by kwikstand
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?
Re: Canonical rel ="next"?
Posted: Mon Aug 01, 2016 2:27 am
by nadeem
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));
}