We recently started working with a large online retailer with a number of Magneto SEO issues. As always, throughout the pitching process and very early into our boarding process, we completed our technical ecommerce SEO audit to ensure we were happy with the technical setup of the Magento site. We found numerous areas of improvement which is sure to keep us busy for some time, but had a unique problem that we were able to solve creatively, which I wanted to share with our Magento SEO readers.
The store uses the out-of-the-box Magento navigation menu system, based on the Magento category store structure. This is usually great for the time saving benefits it brings, however when similar sub category names work their way in to different menus through near-duplicate category pages, duplicate content issues are introduced. Multiply this issue by hundreds and you’ve got a big SEO visibility issue!
If you have duplicate sub category, then subsequent URLs will be appended with a unique ID, similar to; https://demostore.com/sub-category-name-234. To avoid this issue, ensure your URLs are unique, or opt for the longer parent-category/sub-category URL structure.
Solving duplicate category issues
The easiest way to solve this issue is to keep the short sub category URL structure mentioned above, and to engineer your navigation to use custom formats where this deep, cross linking is encouraged.
However, for those of you without the luxury of being able to change this, like we aren’t, for now, you can use Magento’s Custom Layout Update to update your canonical tag to point to your preferred ranking version.
You can find the Custom Layout Update by clicking on the category name you’d like to edit on the Manage Categories screen, and selecting the tab named “Custom Design”.
Custom Layouts are useful across Magento stores for a number of reasons – namely editing layout structures, changing templates and pulling in additional static content blocks on a product, page or category-by-category basis.
Custom Layout Updates use the same XML layout language which is used by the Magento template design process. If you didn’t install your theme yourself, speak with your web developer to get more insight into this. From this point onwards, just copying, pasting and editing is the only skill set you’ll need!
Enabling Magento canonicals
Under the administration panel, navigate to System > Configuration the from the left menu, select Catalog underneath the Catalog menu.
On the page which loads, expand “Search Engine Optimizations” to show the canonical options. Select;
Use Canonical Link Meta Tag For Categories: Yes
Use Canonical Link Meta Tag For Products: Yes
If this is already configured, move to the next step, otherwise save your settings and flush the Magento cache when prompted.
Removing the default canonical tag
This is where Custom Layout Updates come in useful.
In this text area, paste the following;
By replacing the bold URL element with the full URL of the category name, the canonical tag will be successfully removed from the page’s source code. If this doesn’t happen as expected, then one of two things are happening;
- You have copied the URL incorrectly; incorrect URL, missing HTTP/HTTPS, extra spaces added, or
- There is a code execution priority order — your code is being executed too late. Speak to your developer about this!
Adding your new custom canonical
Now you have successfully removed the canonical tag from the specific Magento category page, we need to include a new one. This is achieved through the addLinkRel action method as per the below example.
Finally, bringing this all together, the <reference> tags need not to be duplicated as we’re dealing with the head element on both actions. The resulting code will look something similar like the below;
I hope that helps inspire some better Magento SEO optimisation, even when you feel your hands are tied, or you’re not a developer. Let me know if you have any questions in the comments below!