1

I am having trouble in putting meta robots in selective page. I wanted to Noindex and Follow on login and registration page only and rest of page will have Index and Follow.

I have put <meta name="robots" content="NOINDEX,FOLLOW"/> in /vendor/magento/module-customer/view/frontend/layout/default.xml file but it causes to appear on whole site.

The block I have put in above file for reference.

// Path- /vendor/magento/module-customer/view/frontend/layout/default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <meta name="robots" content="INDEX,FOLLOW"/>
    </head>
    <body>
        ...
    </body>
</page>

Is there any way so I can put some condition here or any other best way to do it.

I am using Magento ver.2.2.6

Thanks

3

Ideally you'd do this in your theme rather than in /vendor/magento - however that aside, you should be adding this content to * customer_account_login.xml * customer_account_create.xml

rather than default.xml. As you noted, default.xml will make it appear everywhere, adding to these two files will only affect login and registration pages.

  • Thank you very much. You save my day – PlanetHackers Jun 13 at 19:12

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.