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
-
Alt tags seo boost
Do alt tags really give you a boost in terms of ranking or is it more for ranking in google images ? Thank you,
Intermediate & Advanced SEO | | seoanalytics0 -
Alt Tags
Hi We have lots of alt tags missing, I know they'e recommended by Google, so moving forward we will ensure we add them to product images, but should we go back and update the ones we have missing? How important is it for SEO? Has anyone tested this? Thanks
Intermediate & Advanced SEO | | BeckyKey0 -
Google Ignoring Canonical Tag for Hundreds of Sites
Bazaar Voice provides a pretty easy-to-use product review solution for websites (especially sites on Magento): https://www.magentocommerce.com/magento-connect/bazaarvoice-conversations-1.html If your product has over a certain number of reviews/questions, the plugin cuts off the number of reviews/questions that appear on the page. To see the reviews/questions that are cut off, you have to click the plugin's next or back function. The next/back buttons' URLs have a parameter of "bvstate....." I have noticed Google is indexing this "bvstate..." URL for hundreds of sites, even with the proper rel canonical tag in place. Here is an example with Microsoft: http://webcache.googleusercontent.com/search?q=cache:zcxT7MRHHREJ:www.microsoftstore.com/store/msusa/en_US/pdp/Surface-Book/productID.325716000%3Fbvstate%3Dpg:8/ct:r+&cd=2&hl=en&ct=clnk&gl=us My website is seeing hundreds of these "bvstate" urls being indexed even though we have a proper rel canonical tag in place. It seems that Google is ignoring the canonical tag. In Webmaster Console, the main source of my duplicate titles/metas in the HTML improvements section is the "bvstate" URLs. I don't necessarily want to block "bvstate" in the robots.txt as it will prohibit Google from seeing the reviews that were cutoff. Same response for prohibiting Google from crawling "bvstate" in Paramters section of Webmaster Console. Should I just keep my fingers crossed that Google honors the rel canonical tag? Home Depot is another site that has this same issue: http://webcache.googleusercontent.com/search?q=cache:k0MBLFcu2PoJ:www.homedepot.com/p/DUROCK-Next-Gen-1-2-in-x-3-ft-x-5-ft-Cement-Board-172965/202263276%23!bvstate%3Dct:r/pg:2/st:p/id:202263276+&cd=1&hl=en&ct=clnk&gl=us
Intermediate & Advanced SEO | | redgatst1 -
Duplicate Content Errors new website. How do you know which page to put the rel canonical tag on?
I am having problems with duplicate content. This is a new website and all the pages have the same page and domain rank, the following is an example of the homepage. How do you know which page to use the canonical tag on? http://medresourcesupply.com/index.php http://medresourcesupply.com/ Would this be the correct way to use this? Here is another example where Moz says these are duplicates. I can't figure out why because they have different url's and content. http://medresourcesupply.com/clutching_at_the_throat http://medresourcesupply.com/index.php?src=gendocs&ref=detailed_specfications &category=Main
Intermediate & Advanced SEO | | artscube.biz0 -
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 -
URL for New Product
Hi, We are creating a section on our established existing website to display our new marketplace product & associated category pages. This marketplace will be a section of the site where our users can sell online training courses that they've created. It will be branded on our site as the Marketplace. Is it important to include 'marketplace' in the URL? Or would it be better to include a relevant keyword such as 'training-courses' instead? Or both? I've assumed I shouldn't use both as that would increase the length of the URLs and number of subfolders.
Intermediate & Advanced SEO | | mindflash0 -
Canonical URL Tag Usage
Hi there, I have a .co.uk website and a .ie website, which have the exact same content on both, should I put a canonical tag on both websites, on every page? Kind Regards
Intermediate & Advanced SEO | | Paul780 -
Most effective Title Tag Structure
I want to target a set of keywords but I want to know which type of Title tag structure or wording is most effective? Here are my target keywords: CMMS, CMMS Software, EAM Software, Maintenance Management Software Do you think using exact keywords terms are most effective? For example: Title tag: CMMS, CMMS Software, EAM Software, Maintenance Management Software Or: Title tag: CMMS Software, EAM Maintenance Management Software Same goes for keyword use for content and H1 tags. Your thoughts? Thanks, John
Intermediate & Advanced SEO | | VizionSEO990