Do you want to hide a Magento 2 page from Google? Sometimes you may need to hide a page from Google to protect your privacy or to keep away unwanted users. In this article, we will show you how to hide a Magento 2 page from Google without affecting your site’s overall SEO.
Hiding a Magento 2 Page From Google
Search engines like Google allow website owners to exclude content from search results. You can do this by using your site’s robots.txt file or using HTML meta tags.
We will show you how to do this in Magento 2 using two methods. You can choose the one that works best for you.
Method 1: Hide a Magento 2 Page from Search Engines Using Magento 2 Backend
This method is easier and recommended for Magento 2 beginners.
1) To hide CMS page for your Magento 2 Store, you will need to login to your admin area and navigate to the Content > Pages section.
2) Select the page you want to hide and click on EDIT.
3) Find and expand Design Tab.
4) Add below code to “Layout Update XML”.
<meta name="robots" content="NOINDEX,NOFOLLOW"/>
5) Save the page.
Method 2: Hide a Magento 2 Page from Search Engines Using robots.txt File
This method requires you to edit the robots.txt file. Adding incorrect instructions in this file can have adverse affect on your site’s SEO, which is why it is not recommended for Magento 2 beginner users.
The robots.txt file is a configuration file that you can add to your Magento 2 site’s root directory. It allows a website to provide instructions for search engine bots, hence the name robots.txt.
You can edit robots.txt file by connecting to your website using an FTP client or ‘File Manager’ in your Magento hosting cPanel.
You will need to add these lines to your robots.txt file.
The user-agent line allows you to target specific bots. We are using asterisk sign to include all search engines. Don’t forget to save your changes and upload robots.txt file back to your server.
That’s all, we hope this article helped you learn how to hide a Magento 2 page from Google.