1

I am finding the shopping cart page of my store is being indexed. How can I noindex the URL https://www.example.com.au/checkout/cart/ ?

3

You have to add following code in checkout.xml

<checkout_cart_index>
    <reference name="head">
        <action method="setRobots"><value>NOINDEX,FOLLOW</value></action>
    </reference>
</checkout_cart_index>

Its Work.

0

You can do this using event observer as follows :
app/code/local/Custom/MetaChange/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_MetaChange>
            <version>1.0.0</version>
        </Custom_MetaChange>
    </modules>
    <global>
        <models>
            <metaChange>
                <class>Custom_MetaChange_Model</class>
            </metaChange>
        </models>
    </global>
    <frontend>
        <events>
            <controller_action_layout_generate_xml_before>
                <observers>
                    <noindex>
                        <type>singleton</type>
                        <class>metaChange/observer</class>
                        <method>changeRobots</method>
                    </noindex>
                </observers>
            </controller_action_layout_generate_xml_before>
        </events>
    </frontend>
</config>

app/code/local/Custom/MetaChange/Model/Observer.php

<?php

class Custom_MetaChange_Model_Observer extends Mage_Core_Model_Abstract {

    public function changeRobots($observer) {

            if ($observer->getEvent()->getAction()->getFullActionName() == 'checkout_cart_index') {
                $layout = $observer->getEvent()->getLayout();
                $product_info = $layout->getBlock('head');
                $layout->getUpdate()->addUpdate('<reference name="head"><action method="setRobots"><value>NOINDEX, FOLLOW</value></action></reference>');
                $layout->generateXml();
            }

        return $this;
    }

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.