PHP Magento Tips

Powered by Blogger.

Add NOINDEX/NOFOLLOW Robots meta tag to Catalog Search Results in magento

Rate this posting:

To prevent search engines (Google, Bing, Yahoo, etc.) from needlessly indexing Magento catalog search results page(s) and advanced search results page(s) add below code to app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout/local.xml.

If this file does not yet exist in your custom theme you can create it and Magento will automatically include it.

If this file already exists in your custom theme then copy everything except the first line XML declaration and elements into your copy of local.xml.

<?xml version="1.0"?>
<layout version="0.1.0">

    <!-- Search Results page -->
      <reference name="head">
         <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>

    <!-- Advanced Search page -->
      <reference name="head">
         <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>

You can then test the results on your Magento website with the following URLs:

Search Results page:

Advanced Search Results page:

Once the page has loaded open up the developer tools (shortcut - F12) or view the generated source code (shortcut - Control + U) and look for 'robots'. The robots setting will display:

<meta name="robots" content="NOINDEX,NOFOLLOW" />

*You may need to flush Magento caches (Admin->System->Cache Management) to see the updated results
Tag : Magento
4 Comments On "Add NOINDEX/NOFOLLOW Robots meta tag to Catalog Search Results in magento"

Back To Top