0

I am using a custom template file to display a form. This has content="INDEX,FOLLOW" set as this is the Magento standard. Is there a way to reset that to NOINDEX,NOFOLLOW for that single phtml file?

Magento 1.9.x

Thanks for helping

1
  • Can you please give some feedback?
    – sv3n
    Nov 20, 2018 at 18:15

2 Answers 2

1

If you are using separate page and it can be done using controller file as well.

<?php
class Vendor_Extension_IndexController extends Mage_Core_Controller_Front_Action
{
        public function YourAction() 
        {
            $this->loadLayout();    
            $this->getLayout()->getBlock("head")->setRobots('NOINDEX,NOFOLLOW');
            $this->renderLayout(); 
        }
}
0

If it is for a category or product, you can add this to custom layout section:

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

Or for a single page add this to your local.xml, example for contacts page

<contacts_index_index>
    <reference name="head">
        <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
    </reference>
</contacts_index_index>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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