Magento – Adding Canonical URL for CMS Pages via Layout XML

You can use the following code to do that. First remove the current URL and then add a new URL.

<reference name="head"> 
    <action method="removeItem">
        <type>link_rel</type>
        <name>http://www.sumitron.com/company</name>
    </action>
    <action method="addLinkRel">
        <rel>canonical</rel>
        <href>http://www.sumitron.com/company/about-us</href>
    </action>
</reference>

Leave a Reply