Remove canonical link in Magento 1.9.3.x

707 views Asked by At

I want to remove the canonical link from a html page (Site Map).

<link rel="canonical" href="https://www.example.com/seositemap">

I used the following code in a layout and it does not work

<?xml version="1.0"?>
<layout version="0.1.0">
    <seositemap_index_index>
        <reference name="content">
            <block type="seositemap/map" name="map" template="seositemap/map.phtml"/>
        </reference>
        <reference name="head">
            <action method="removeItem"><type>link_rel</type><rel>canonical</rel></action>
        </reference>
    </seositemap_index_index>
</layout>

Any idea ?

1

There are 1 answers

2
Vladimir Samsonov On

here is how the method looks like

public function removeItem($type, $name)
{
    unset($this->_data['items'][$type.'/'.$name]);
    return $this;
}

there is no rel parameter. You should use "name" instead. And its content has to be the href of current link