2

Doe anyone know where and how to remove <meta name="robots" content="INDEX,FOLLOW"/> tag for good?

Thanks!

  • I guess that you want to make noindex for google . right? – Amit Bera Jun 5 '18 at 14:37
  • Just goto Login in your Magento admin backend Select Content -> Design -> Configuration Select Theme in Website View -> than changes Search Engine Robots = NOINDEX, NOFOLLOW – Amit Bera Jun 5 '18 at 14:44
  • @Amit Bera No Remove actually remove completely it I've been asked by SEO team said that robot.txt will handle this. – Juliano Vargas Jun 5 '18 at 14:51
4

In such case, you need to override the Magento\Framework\View\Page\Config\Renderer

As this class's the method renderMetadata responsible for meta title render. On the override class's at that method add this condition:

        // add this code for stop render of robot
        if ($name = 'robots') {
            continue;
        }

Override function may be look

public function renderMetadata()
    {
        $result = '';
        foreach ($this->pageConfig->getMetadata() as $name => $content) {
            $metadataTemplate = $this->getMetadataTemplate($name);
            if (!$metadataTemplate) {
                continue;
            }
            // add this code for stop render of robot
            if ($name == 'robots') {
                continue;
            }
            $content = $this->processMetadataContent($name, $content);
            if ($content) {
                $result .= str_replace(['%name', '%content'], [$name, $content], $metadataTemplate);
            }
        }
        return $result;
    }
1

You do not want to remove the tag from the code as this is a back-end setting. You can change the setting by logging in to your back-office then go to

Content -> Design -> Configuration

then click on the correct storeview. Under the tab Search Engine Robots you find the option

  • I can not able to update, It's disabled. – Ravi Soni Oct 17 '18 at 13:24

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.