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
-
How does product category description affect SEO?
Hi - we are a website that sells tours. We have category pages that list the tours in that category (by city, by length of time, theme, etc). At the top of each category page, before the buttons linking to the tours, there is a category description. It is a pretty long paragraph. We are redesigning the website and think it would look nicer to show 2-3 lines of text and then have a down arrow and 'read' more so people can click and it would expand to show the full category description if they want to read it and it won't take up so much room that way. My question is - will this affect SEA at all? Or because the text is still there, just hidden, it won't do anything? Our site ranks very high in organic searches on google and we do not want to do anything that will hurt SEO. thanks.
Intermediate & Advanced SEO | | Shirapn0 -
Homepage has canonical tag pointing to innerpage
Hi, I'm stuck! This e-commerce site which I'm currently working on has an unusual problem. So the homepage has a canonical tag pointing to one of its category pages. Is this okay SEO-wise? Based on what I understand, the homepage is the most important page in a site. And if there is a mirror duplication, it would be better to canonicalise the inner page to the homepage rather than in reverse. Looking forward to getting some answers. Cheers!
Intermediate & Advanced SEO | | nerdieb0 -
How to create AMP Pages for product website?
How to create AMP Pages for product website? I mean we can create it easily when we have wordpress through plugin, what about when we have millions of pages, It would be too tedious to create amp version of every page. So, is there any alternative way to create amp version?
Intermediate & Advanced SEO | | sachin.kaushik0 -
Duplicate content on product pages
Hi, We are considering the impact when you want to deliver content directly on the product pages. If the products were manufactured in a specific way and its the same process across 100 other products you might want to tell your readers about it. If you were to believe the product page was the best place to deliver this information for your readers then you could potentially be creating mass content duplication. Especially as the storytelling of the product could equate to 60% of the page content this could really flag as duplication. Our options would appear to be:1. Instead add the content as a link on each product page to one centralised URL and risk taking users away from the product page (not going to help with conversion rate or designers plans)2. Put the content behind some javascript which requires interaction hopefully deterring the search engine from crawling the content (doesn't fit the designers plans & users have to interact which is a big ask)3. Assign one product as a canonical and risk the other products not appearing in search for relevant searches4. Leave the copy as crawlable and risk being marked down or de-indexed for duplicated contentIts seems the search engines do not offer a way for us to serve this great content to our readers with out being at risk of going against guidelines or the search engines not being able to crawl it.How would you suggest a site should go about this for optimal results?
Intermediate & Advanced SEO | | FashionLux2 -
Multiple Ecommerce sites, same products
We are a large catalog company with thousands of products across 2 different domains. Google clearly knows that the sites are connected. Both domains are fairly well known brands - thousands of branded searches for each site per month. Roughly half of our products overlap - they appear on both sites. We have a known duplicate content issue - both sites having exactly the same product descriptions, and we are working on it. We've seen that when a product has different content on the 2 sites, frequently, both pages get to page 2 of the SERPs, but that's as far as it goes, despite aggressive white hat link building tactics. 1. Is it possible to get the same product pages on page 1 of the SERPs for both sites? (I think I know the answer...) 2. Should we be canonicalizing (is that a word?) products across the sites? This would get tricky - both sites have roughly the same domain authority, but in different niches. Certain products and keywords naturally rank better on 1 site or the other depending on the niche.
Intermediate & Advanced SEO | | AMHC0 -
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 -
What do you do with the page of a product that has been deleted?
As anyone know with an ecommerce website, products are constantly being added and removed. Once products are removed, the corresponding product pages are not reachable. Currently, I am redirecting to the Search page, if a product page is reached, whose corresponding product has been deleted. I am not sure if that is the correct, recommended technique from a SEO perspective. Should I try to show related products on the redirected page? Does anyone here know what is the best thing to do with this product page?
Intermediate & Advanced SEO | | amitramani0 -
Backlinking from a Canonical Page to the Non-Canonical Doman - Wrong Signals?
Hi Mozzers, Let's say you have www.mysite.com/page, which is a duplicate of www.yoursite.com/page. www.yousite.com/page has a rel canonical link identifying www.mysite.com/page as the original source. www.mysite.com/page has a followed backlink going towards www.yousite.com/home-page. mysite.com has a DA of 44
Intermediate & Advanced SEO | | Travis-W
yoursite.com has a DA of 33 Google has chosen to index www.yoursite.com/page instead of www.mysite.com/page. Is the followed backlink responsible for the wrong page being indexed? Thanks!0