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
-
Ecommerce Link Juice and Canonical URLs
Hello all. I am optimising an E-Commerce site and I have a questions about Products in several categories & Canonical URL's. Using Magento Platform. site.com/category1/product1/ ( link from category is site.com/product1/ )
Intermediate & Advanced SEO | | s_EOgi_Bear
site.com/category2/product1/ ( link from category is site.com/product1/ )
site.com/category2/subcategory1/product1 ( link from category is the same , as is the canonical URL )
site.com/product1/ ( this is where other categories link to ) Canonical links for all the above is site.com/category2/subcategory1/product1 which takes care of duplicate content correctly. I just wonder if we would get more link juice if ALL the links from all categories went to site.com/category2/subcategory1/product1 ( instead of some going to site.com/product1/ ) Thanks in advance 🙂0 -
Is it ok to add snippet of information taken from other sites on product pages?
Hello here, I own an e-commerce website that sells digital sheet music, and I would like to enrich my product pages with short references to artists/composers related to the product, taken from external websites such as mentions, fresh news, information taken from related videos, cross-references, etc. In other words, I'd like to provide our users with a different kind of informational content that our competitors are currently not offering. We could also think of this like "providing some sort of aggregate content on product pages to enrich the user's experience by providing more information about the product". What do you think are the risks or the benefits of such an approach? And if there are any risks, how to avoid/tackle them? Any thoughts are very welcome! Thank you in advance to anyone.
Intermediate & Advanced SEO | | fablau0 -
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 -
Should I block wordpress archive and tag?
I use Wodpress and Wordpress SEO by Yoast. I've set ip up to add noindex meta tag on all archive and tag pages. I don't think its useful to include thoses pages in search results because there's quite a few. Especialy the tag archive. Should I consider anything else or change my mind? What do you think? Thanks
Intermediate & Advanced SEO | | Akeif0 -
Canonical vs noindex for blog tags
Our blog started to user tags & I know this is bad for Panda, but our product team wants use them for user experience. Should we canonizalize these tags to the original blog URL or noindex them?
Intermediate & Advanced SEO | | nicole.healthline0 -
Removing Canonical Links
We implemented rel=canonical as we decided to paginate our pages. We then ran some testing and on the whole pagination did not work out so we removed all on-page pagination. Now, internally when I click for example a link for Widgets I get the /widgets.php but searching through Google I get to /widgets.php?page=all . There are not redirects in place at the moment. The '?page=all' page has been rated 'A' by the SEOmoz tool under On Page Optimization reports and performs much better than the exact same page without the '?page=all' (the score dips to a 'D' grade) so need to tread carefully so we don't lose the link value. Can anyone advise us on the best way forward? Thanks in advance.
Intermediate & Advanced SEO | | jannkuzel0 -
Hierachy in a Title Tag Needed?
When coding the title tags of a website, is it important to note the hierarchy of the website so the search engine can find that page? So, for example, the title tag would be, for a subcategory: Webpage Subcategory>Category>Website name Does this help the search engine rankings at all? Or can the search engines figure out the hierarchy by reading a sitemap or the HTML readable navigation? Then you could focus on the descriptive keywords of the subcategory page for the title tag. Also, should you always include the site name in the title tag?
Intermediate & Advanced SEO | | ConnellyPartners0 -
301 Redirect or Canonical Tag or Leave Them Alone? Different Pages - Similar Content
We currently have 3 different versions of our State Business-for-Sale listings pages - the versions are: **Version 1 -- Preferred Version: ** http://www.businessbroker.net/State/California-Businesses_For_Sale.aspx Title = California Business for Sale Ads - California Businesses for Sale & Business Brokers - Sell a Business on Business Broker Version 2: http://www.businessbroker.net/Businesses_For_Sale-State-California.aspx Title = California Business for Sale | 3124 California Businesses for Sale | BusinessBroker.net Version 3: http://www.businessbroker.net/listings/business_for_sale_california.ihtml Title = California Businesses for Sale at BusinessBroker.net - California Business for Sale While the page titles and meta data are a bit different, the bulk of the page content (which is the listings rendered) are identical. We were wondering if it would make good sense to either (A) 301 redirect Versions 2 and 3 to the preferred Version 1 page or (B) put Canonical Tags on Versions 2 and 3 labeling Version 1 as the preferred version. We have this issue for all 50 U.S. States -- I've mentioned California here but the same applies for Alabama through Wyoming - same issue. Given that there are 3 different flavors and all are showing up in the Search Results -- some on the same 1st page of results -- which probably is a good thing for now -- should we do a 301 redirect or a Canonical Tag on Versions 2 and 3? Seems like with Google cracking down on duplicate content, it might be wise to be proactive. Any thoughts or suggestions would be greatly appreciated! Thanks. Matt M
Intermediate & Advanced SEO | | MWM37720