How to add Canonical Tags on Opencart Products
-
Does anyone know how to add canonical tags to product pages in Opencart?
Is this possible to do in htaccess? If so, how specifically should it be written in?
Please do not post any links to other pages which reference generic canonical information as I've read them all and none help. I'm looking for an Opencart specific answer, or a way to do it in htaccess.
-
Apparently this didn't work. According to the Moz tool I have the same amount of duplicate title tags as before.
-
I suggerst you to adopt the following :
The best way to achieve this is to modify your Document class, set your canonical in your controller, then render it in the header controller.
Edit system/library/document.php
add:
private $canonical;
to your class variables up top.Then add the following methods:
<code>publicfunction setCanonical($url){ $this->canonical = $url;}publicfunction getCanonical(){return $this->canonical;}</code>
In your header controller add:
$this->data['canonical'] = $this->document->getCanonical();
Then you can set your canonical dynamically in the header controller:
<code>if(isset($this->request->get['_route_'])): $canonical_route = $this->request->get['_route_'];else: $canonical_route =''; endif; $this->document->setCanonical($this->data['base']. $canonical_route);</code>
Or you can set it manually in your controllers using the setCanonical method.
-
Hi there,
In continuation to my response earlier on another question.
Have u tried these extensions on Opencart? http://www.opencart.com/index.php?route=extension/extension&filter_search=canonical url
Thanks,
Vijay
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Product Pages not indexed by Google
We built a website for a jewelry company some years ago, and they've recently asked for a meeting and one of the points on the agenda will be why their products pages have not been indexed. Example: http://rocks.ie/details/Infinity-Ring/7170/ I've taken a look but I can't see anything obvious that is stopping pages like the above from being indexed. It has a an 'index, follow all' tag along with a canonical tag. Am I missing something obvious here or is there any clear reason why product pages are not being indexed at all by Google? Any advice would be greatly appreciated. Update I was told 'that each of the product pages on the full site have corresponding page on mobile. They are referred to each other via cannonical / alternate tags...could be an angle as to why product pages are not being indexed.'
Intermediate & Advanced SEO | | RobbieD910 -
Product or Shop in URL
What do you think is better for seo and for sale, I am using woo-ecommerce for health products website. websitename.com/product/keyword OR websitename.com/shop/keyword
Intermediate & Advanced SEO | | MasonBaker0 -
Googleon/off tag does it work
Hi I am currently working on a page where I have some of the content across all pages. Rewriting it to make it unique is not an option I am afraid. I came across a tag called Googleon/off that will tell google not to index a certain part of a give webpage but will this ensure that it is not seen as dupplicate content? https://developers.google.com/search-appliance/documentation/610/admin_crawl/Preparing
Intermediate & Advanced SEO | | AndersDK0 -
Product Page rankings - How to boost?
Hi folks I am responsible for an e-commerce website. Our website is doing very well but I believe that our product pages should be ranking more highly than they currently are. When taking over my current role, it became clear that a number of changes would need to be made to try and boost the under performing product pages. Amongst other things I therefore implemented the following: New Product content - we have placed a massive focus on reworking all product content so that it is unique and offers value to the reader. The new content includes videos, images and text that is all keyword rich but (I hope) not seen as overly spammy. Duplicate content - the CMS was creating multiple versions of the same page - I addressed this by implementing 301 redirects and adding canonical links. This ensures there is now only 1 version of the page Parameters - I instructed Google to not index certain URLs containing specific parameters Internal links - I have tried to improve the number of links to the products from relevant key category pages My question is, although some of the changes have only been in place for a month, what else can I do to ensure that the product pages rank as highly as possible. As an e-commerce website with so many products it is very difficult to link to these product pages directly, so any tips or suggestions would be welcome! Here's an example of a product page link : http://www.directheatingsupplies.co.uk/pid_37440/100180/Worcester-Greenstar-29CDi-Classic-Gas-Combi-Boiler-7738100216-29-Cdi.aspx
Intermediate & Advanced SEO | | DHS_SH0 -
Bad use of the Rel="canonical" tag
Google is currently ranking my category page instead of our homepage for our key term and we would rather have our homepage rank for the term. Would it be a bad idea to rel="canonical" our category page to our homepage? Our homepage is optimized to rank for the keyword and has more PR than our category page. However, I don't really know if this will have negative repercussions. Thanks, Jason
Intermediate & Advanced SEO | | Jason_3420 -
Include Product Price in Rich Snippet?
Should price be included in rich snippets? Is there any research supporting inclusion or exclusion of prices in snippets?
Intermediate & Advanced SEO | | AWCthreads0 -
Canonical links apparently not used by google
hi, I do have an ecommerce website (www.soundcreation.ro) which in the last 3 months had a drop in the SERP. Started to look around in GWT what is happening. Google is reporting a lot of duplicate meta-tags (and meta-titles problem). But 99% of them had already canonical links setted. I tried to optimize my product listings with the new "prev", "next" tags and introduced also the "view-all" canonical link to help Google identify the appropiate product listing pages. SeoMoz is not reporting thos duplicate meta issues. Here is an example of the same page with different links, but with the same common canonical and reported by GWT "duplicate title tag": http://www.soundcreation.ro/chitare-chitari-electroacustice-cid10-pageall/http://www.soundcreation.ro/chitare-chitari-electroacustice-cid10/http://www.soundcreation.ro/chitare-chitari-electroacustice-cid10_999/http://www.soundcreation.ro/chitare-electro-acustice-cid10_1510/What could be the issue?- only that gwt is not refreshing as should be, keeping old errors?- if so, then there is an other serious issue because of why our PR is dropping on several pages?- do we have other problem with the site, which ends up with google penalizing us? Thank you for your ideas!
Intermediate & Advanced SEO | | bjutas0 -
Why should your title and H1 tag be different?
Is it dangerous to have your H1 tag and your title the exact same thing? My thought was that it's not be the best use of space, but that it couldn't cause harm. What do you think?
Intermediate & Advanced SEO | | MarieHaynes7