The canonical url is provided on every page if you follow the steps described in this post.
To provide an accurate as possible answer to your questions, please do you mind providing some examples and most importantly describing in details what exactly you are trying to achieve please?
My understanding from the above is a canonical tag is provided on the product pages, not the category pages, no? The {product[‘product_canonical_link’]} does seem to return a value on product pages, however, not category pages.
Currently our category pages (product lists) are paginated eg: “http://…/accessories/widgets/?page=1”, “?page=2”, etc.
Obviously it would be best practice to canonical tag these pages back to the originating category page.
However, I would Ideally like to do the following:
have a category page that lists ALL of the products in a said category (view all)
canonical tag all “?page=1,2,3,4,etc” paginated category pages to the view all page.
Initially I was trying to just tag it back to the primary category page as that would be acceptable, but even trying to do that I cannot seem to retrieve the category url variable I need for this.
Hopefully the above explains the issue more clearly, if not please let me know.
@franclin_foping Has there been any update on a fix for this issue? I can confirm our site also has the same bug so it’s obviously affecting all stores.
Also, there is another issue which we have raised as a ticket recently describing that the canonical tag appears to be self referencing and therefore allows for stray URL parameters like sort=price&order, gclid, utm_source etc to end up being referenced in the canonical tag, obviously undesirable.
This only occurs with links that are shared (with those additional URL parameters) via external sites. None the less they do end up being indexed and are therefore another cause of duplicate content which should be addressed.
I am confused. Andy and I are talking about the same thing. You replied to me saying to use the product canonical variable for the category pages and NOT product pages. But then told Andy that you were going to fix the issues?
Ok, I have tried using {product[product_canonical_link]} for the category pages, and nothing comes back.
How do I get a canonical URL for the category pages to stop the duplicate content penalties I am getting for having page 1,2,3,4,5,6,etc for each category in our store.
I’m afraid the {product[product_canonical_link]} will only work on product pages.
The canonical URL on listing pages is the current page. So for instance, if you are visiting the page number 5 in the category page then it will be set to something like page5.html
To prevent duplication penalties, the page should instead tell to search engines the linkage between those pages as explained in the post. For instance in the header of page5.html there should be a prev link tag which points to the previous page (page4.html) and an eventual next rel tag which points to the next tag (page6.html).
If you could provide an actual page, then I can give you more explanation if you wish.
I feel like I have been clear in communicating what I was looking for since the very first post and am going around in circles. If this is not the case, then my apologies and I will try and be clearer one more time.
Per my original post:
I then went on to say:
I understand that the canonical tag provided is for the product page and not the category page. And that I am looking for a page to canonical the categories to such as a view all page. Even still, the very first question I asked was for the category base url eg: “page 1” or “www…com/category/” url and if there is a way to generate a view all page.
You then say
Then finally I am told that the canonical link for the category is the same as the page in the category eg: page5 will be canonical tagged with page5…
But no solution was given, you went into their template and fixed it and referenced $this post.
How do i retrieve either the base category url for the said category(page1,2,3,4,5,6) to use as the canonical page. eg: /widgets?page=5 would provide a canonical url of …widgets/ or …/widgets?page=1
Is there a way to generate a view all page for categories so that I may canonicalize all of my page 1,2,3,4,5,6… to that page eg: widets?page=5 canonicalizes to widgets/ or best practices would be widgets/all
I would like to use canonical tags with a view all page rather than next and prev as it is considered a more definitive solution with less likelihood of issues and will provide a potential increase in usability.
However If the above cannot be accomodated, my next question would be:
how do I retrieve the prev and next url’s using nitroscript?
What variables do I check against to determine if there IS a next or prev? Are they bool, strings, eg will they return null/true/int to an if(category[next_page]){echo ‘…link…’;}
That error would mean that the store on which you are trying to apply the nitroscript is not on Beta. As I mentioned in the post, the feature is only currently available in our Beta channel.
however to the other issue regarding prev and next:
How do i retrieve either the base category url for the said category(page1,2,3,4,5,6) to use as the canonical page. eg: /widgets?page=5 would provide a canonical url of …widgets/ or …/widgets?page=1
Is there a way to generate a view all page for categories so that I may canonicalize all of my page 1,2,3,4,5,6… to that page eg: widets?page=5 canonicalizes to widgets/ or best practices would be widgets/all
how do I retrieve the prev and next url’s using nitroscript?
What variables do I check against to determine if there IS a next or prev?
Could you please provide a code example?
PS: Just a suggestion, but maybe mention the ‘beta’ part in the initial solution, and not after the solution examples have been given?
Currently it is in the section titled: 4. Bibliographic Notes