Hello Magento Friends,

Today we will focus on How to set NOINDEX NOFOLLOW for Specific Page in Magento 2.

Magento allows managing instructions to index your website for web crawlers. You can control and prevent pages of your website to be indexed and crawled by search engines. For that, you can Configure Robots.txt in Magento 2.

NOINDEX stops web crawlers to crawl and index your webpage while NOFOLLOW stops web crawlers to follow links on the webpage. You can also Configure Robots.txt in Magento 2

Magento 2 gives the option to NOINDEX and NOFOLLOW for the whole site but whenever your site is live and sometimes you need to set NOINDEX and NOFOLLOW for a specific page then you need to follow the below steps

Steps to set NOINDEX NOFOLLOW for Specific Page in Magento 2:

Step 1:  First you need to create one event.xml file in the following path

app\code\Vendor\Extension\etc\frontend\event.xml

Now, add the below code

Step 2: Now you need to create Noindexfollow.php in the following path

app\code\Vendor\Extension\Observer\Noindexfollow.php

And, add the code as follows

Conclusion:

By doing so you can set NOINDEX NOFOLLOW for Specific Page in Magento 2 easily. If you face any problem implementing the above steps, drop a comment below. Spread the article with your friends and stay connected with us!

Happy Coding!

Click to rate this post!
[Total: 6 Average: 4.2]