How can I set a specific page to NO INDEX, NO FOLLOW in Magento 2?


1 Answer 1


Does this answer your issue ? https://www.mag-manager.com/product-information/set-magento-2-noindex-and-nofollow-tags/

You can also handle it yourself with an observer on the following event : layout_generate_blocks_after

class MetaRobots implements ObserverInterface {

protected $request;

protected $layoutFactory;

public function __construct(
    \Magento\Framework\App\Request\Http $request,
    \Magento\Framework\View\Page\Config $layoutFactory
) {
   $this->request = $request;
   $this->layoutFactory = $layoutFactory;

    public function execute(Observer $observer) {

    $fullActionName = $this->request->getFullActionName();

     if ($fullActionName == "catalog_product_view"){

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.