Magento SEO: Canonical URL (Url Canonici)
Canonical LinksOne of the things that can be an SEO concern for Magento deployments is the proliferation of URLs that don’t have unique content. If you haven’t realized this, the product URL, and the Category/Product URL are the same content, but the URL is different. Which one should the search engine index? Both? If it does, you lose some of the “Link Juice” and your page rank can suffer.
Google addressed this concern not specifically for Magento sites in a June 17th, 2011 posting. In this article Google explains how they support canonical relational links in the header. Now you just need to add these to the header of your Magento pages so that Google and other search engines can realize that the category item and the product item are the same page. And here is a quick way to do just that.
First, you will need to be familiar with your theme, and navigate to the app/design/frontend/[theme name]/main/page/html/page/
Here you will find a file called head.phtml This is the file you will need to edit.
Adding canonical links for your products and categories:
In the head.phtml file find the group of code that has content. In mine this was right after the content.
What is this doing?
First there is a call to the Magento Registry to find out where the visitor is looking. The PHP if condition is looking for if this is a product, or category.
Inside the if condition we create the html Inside the link tag, we are going to call the Magento Registry and get the product or category URL to use as the HREF target.
This does one of three things; create a link tag with the category URL, create link with product URL, or not create anything.
After you save the file you can see that it works by going to a category or product page. You will have to view the page source and look in the
And it is just that simple.
You now have a Magento Store that will concentrate its “Link Juice” on fewer URLs and reduce a redundancy of indexing in the search engines.