Last Updated on
Canonicals urls are an essential part of avoiding duplicate content in an ecommerce store, and should be added to all pages and products by default.
However, the Opencart CMS doesn’t include any canonical urls for the Homepage or the Category / Sub-category pages, leading to lots of duplicate content issues, and potentially causing issues in your SEO efforts.
I’m going to show you exactly which canonicals you need, and how to easily insert them into your store using a FREE VQMOD file.
What is a canonical url and why do you need one?
Simply put, a canonical link points to the “proper url location” of a page, to avoid Google indexing duplicate page urls, and maintain the link equity of your website.
Examples of Duplicate Content in Opencart
There are plenty of examples in Opencart of duplicate content that can harm your websites Google rankings.
For example if you can visit a product via different routes such as:
- Homepage -> Category -> Product
- Homepage -> Category -> Sub-category -> Product
- Homepage -> Product
These urls will all have different url paths:
When Google crawls your website, it follows all of these variations, and so each of these links will be crawled, and counted as a different page.
Duplicate Content And Google Panda Penalties
Google HATES duplicate content with a passion, particularly duplicate content on the same website.
They have an algorithm dedicated to penalising websites for this, called Panda, which is notorious for not just harming the pages with duplicate content, but bringing the entire websites rankings down.
Fix Duplicates with a Canonical Link
Luckily there is a fantastic way to tell Google that each of these pages are the same, and then tell them which one you would like to count as the “proper location”.
That’s called a canonical link, and it looks like this:
<link href="http://domain.com/product" rel="canonical" />
In our example, if this was added to the product page as a canonical link, then it tells Google that the Homepage -> Product version of this url is the only one that should be indexed.
This fixes the duplicate content, as Google only indexes one version of the page, keeping all of your indexed content unique, and resulting in higher rankings.
Stop Losing Link Equity With Canonicals
Canonicals also prevent you from spreading your link equity too thinly over your website. For example if someone links to these two pages:
Then without a canonical url, you will have one link to each page, and two competing pages that can cause keyword cannibalisation.
With a canonical url, the link pointing to the non-canonical version of the page will be counted towards the rankings of your main page, helping it rank even better in Google for its target keywords.
How to Add a Canonical Link to Your Opencart Homepage
The homepage of your online store is the single most important page from an SEO perspective.
It will normally have the greatest amount of inbound links, and contain internal links to your other most important pages, spreading the authority to the rest of your website.
So what’s the problem?
Without a canonical, multiple variations of the homepage url can be indexed in Google, urls such as:
These will all display the same page (your homepage), but because they are separate urls Google treats them as unique pages.
The Code To Add a Homepage Canonical in Opencart
You will need to edit one of your website files via FTP or file manager to do this. Alternatively for a better way to implement it, you can use the FREE VQMOD file at the end of this guide.
First navigate to: catalog/controller/common/ and open the file home.php.
Next you will want to find the line:
And below it, add the following code:
You will need to replace the example url with the homepage url of your Opencart store.
How to Add a Canonical Link to Your Opencart Category Pages
As mentioned above, your category pages require canonicals to ensure no duplicate paths are indexed, and to maintain your link equity.
This is a particular problem with category pages that contain product filters, as they often create new urls when you choose a filter.
For example when you filter the product list by Price Low > High in Opencart the url looks like this:
Without a canonical, this will index as a new url, and cause a Google Panda penalty from duplicate content as mentioned previously
The Code for an Opencart Category Canonical
It’s quite simple to add this code to the category controller, and produce your own category canonical links. HOWEVER, if you would rather have the simple and FREE version of doing it, see the free VQMOD file attached at the end of this post.
Via FTP, visit this location in your store: catalog/controller/product/ and open the file category.php.
Find the following line of code:
And below it add this code:
$this->document->addLink($this->url->link('product/category', "path=".$this->request->get['path']), 'canonical');
This will produce the canonicals on every category and sub-category page.
Free Vqmod To Insert Homepage & Category Canonicals
Here is your free SEO loophole, a VQMOD file that automatically inserts the canonical for the homepage url, and your category urls.
Simply like or subscribe to gain access to the file below.
How useful was this post?
Click on a star to rate it!
Average rating 5 / 5. Vote count: 3
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!
- 1 What is a canonical url and why do you need one?
- 2 How to Add a Canonical Link to Your Opencart Homepage
- 3 How to Add a Canonical Link to Your Opencart Category Pages
- 4 Free Vqmod To Insert Homepage & Category Canonicals
- 5 How useful was this post?
- 6 We are sorry that this post was not useful for you!