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
-
Canonical Issue On AMP
Hi everyone,
Intermediate & Advanced SEO | | MuhammadQasimAttari
I have one issue about canonical. kindly guide me about it. I have a site example.com/abc and I convert it on an amp and know its URLs is example.com/abc=?amp. but the search console tells me to add the proper canonical URL but both pages are the same. kindly guide me about it. what will I do?0 -
Best Practice Approaches to Canonicals vs. Indexing in Google Sitemap vs. No Follow Tags
Hi There, I am working on the following website: https://wave.com.au/ I have become aware that there are different pages that are competing for the same keywords. For example, I just started to update a core, category page - Anaesthetics (https://wave.com.au/job-specialties/anaesthetics/) to focus mainly around the keywords ‘Anaesthetist Jobs’. But I have recognized that there are ongoing landing pages that contain pretty similar content: https://wave.com.au/anaesthetists/ https://wave.com.au/asa/ We want to direct organic traffic to our core pages e.g. (https://wave.com.au/job-specialties/anaesthetics/). This then leads me to have to deal with the duplicate pages with either a canonical link (content manageable) or maybe alternatively adding a no-follow tag or updating the robots.txt. Our resident developer also suggested that it might be good to use Google Index in the sitemap to tell Google that these are of less value? What is the best approach? Should I add a canonical link to the landing pages pointing it to the category page? Or alternatively, should I use the Google Index? Or even another approach? Any advice would be greatly appreciated. Thanks!
Intermediate & Advanced SEO | | Wavelength_International0 -
Bad SEO Practice: in title tag?
Greetings, I just discovered that some of our content was produced with
Intermediate & Advanced SEO | | Eric_Lifescript
tags in the title tag. Example: <title>Diabetes Symptoms <br> In Women Over 40</title> My gut says this is bad for SEO, but I couldn't find a definitive answer on the web, so I thought I would ask the community of gurus here at Moz. 🙂 Thanks in advance for any reply. Kind regards, Eric0 -
Problems with Squarespace Title Tags
Hi All, I'm having problems editing the title tags on individual pages on Squarespace. It seems the only way to do it is via the page title name. Here is an example: http://www.autismsees.com/research/. The page is called research, so it makes that the meta title. The problem is I want to keep research on the page and the Meta Title be: Autism Spectrum Research. I'v tried searching over the web, but no luck so far. Thanks for your help.
Intermediate & Advanced SEO | | PeterRota0 -
How to title my products?
Hi, really struggling with product titles. Or should I say keeping staff writing out titles. If I sell a Coat. I would like the product titled like: Armani Jeans Coat Green but staff are doing it like Armani Jeans Fur Hooded Coat Green. Now I think this effects our SEO efforts as how likely are people to search for the Fur Hooded coat part? Yes we might hit the numbers of the small search but is it really worth it? Would it not be best put this Fur Hooded part in the short description and long description? I am trying to make my SEO titles and meta descriptions consistant for 1 product. But find it hard writing out Fur Hooded in the Meta Title when I know numbers will be minimal? The SEO titles or the product titles are effectively links on the website for each product. So hold more weight and the product titles act as the H1 titles on the product page itself. Surely we would be best using Armani Jeans Coat Green rather than such a long, obscure title that will gain very little search? Whats best way to approach this issue? As we can have products titled like: Creative Recreation Kaplan Patent Leather/Snake Trainers Charcoal. Which to me is too long, too obscure. Surely the extra detail should go in Short Description which is visible on the catelog page and keep the product titles shorted and more to the point, eg Creative Recreation Kaplan Trainers Snake Charcoal? All this Patent Leather/ business seems pointless to me? Any ideas?
Intermediate & Advanced SEO | | YNWA0 -
1 Ecommerce site for several product segments or 1 Ecommerce site for each product segment ?
I am currently struggling with the decision whether to create individual ecommerce sites for each of 3 consumer product segments or rather to integrate them all under one umbrella domain. Obviously integration under 1 domain makes link building easier, but I am not sure how far google will favor in rankings websites focussed on one topic=product segment. Product segments are medium competitive.Product segments are not directly related but there may be some overlap in customer demographics- Any thoughts ?
Intermediate & Advanced SEO | | lcourse1 -
Are pages with a canonical tag indexed?
Hello here, here are my questions for you related to the canonical tag: 1. If I put online a new webpage with a canonical tag pointing to a different page, will this new page be indexed by Google and will I be able to find it in the index? 2. If instead I apply the canonical tag to a page already in the index, will this page be removed from the index? Thank you in advance for any insights! Fabrizio
Intermediate & Advanced SEO | | fablau0 -
What to do with non-existing products (removed products)?
Hello, I'm selling unique products - only one of a kind of each product.
Intermediate & Advanced SEO | | BeytzNet
This means that whenever a product is sold, it is removed from display. In order not to upset Google by keep removing indexed pages I created a "sold items" page which links to all of the removed products. The problem is (or maybe it's not a problem) is that I got to the point where I have more "sold items" then existing items (and the list keeps adding up). What should I do with the non-existing items?
Was I correct? ---------------------------------------- ADDED INFO --------- The way the site is built is that I have main category pages and each of them is showing a large amount of products. Most of these products got indexed by Google. Each product has its own unique URL (Products do not return...) Once a product is sold it does not come up in the product categories - I only have a general "sold items" in the footer that shows all of them (with a lot of pagination). Since the products are rapidly changing, i thought it would upset Google to have a hundred 301 redirects in each week or two. Since the products are very similar to one another (only different measurements / colors etc.), I thought of having a link from a sold Item to a similar available item so if Google will direct someone it will probably be to the available product. The problem is that the sold items are now 4 times more than the number of available items... I don't think that a store should display 2008's t-shirts on 2012... Another problem that may rise with so many products is that I'm afraid that the one type of product that is being sold much more often will take charge at the end on the entire site since I will end up with 8,000 sold items of this product, 1000 sold items of other products and 1000 available misc products... this might also start causing duplication problems as the products are quite similar. Should I stop with the "Sold" products and use 301's? Thanks0