Created
November 13, 2014 20:06
-
-
Save jasontipton/9e35ae3f878282ba37ae to your computer and use it in GitHub Desktop.
Magento Local.xml NOINDEX/NOFOLLOW Catalog Search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<layout version="0.1.0"> | |
<!-- Search Results page --> | |
<catalogsearch_result_index> | |
<reference name="head"> | |
<action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action> | |
</reference> | |
</catalogsearch_result_index> | |
<!-- Advanced Search page --> | |
<catalogsearch_advanced_result> | |
<reference name="head"> | |
<action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action> | |
</reference> | |
</catalogsearch_advanced_result> | |
</layout> |
You might want also want to remove Popular Search Terms from the SERPs. You can do this by adding
<!-- Popular Search Terms-->
<catalogsearch_term_popular>
<reference name="head">
<action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
</reference>
</catalogsearch_term_popular>
This is worth adding too, as Magento seems to generate a lot of links to catalogsearch/advanced/?....
<!-- Advanced Search page -->
<catalogsearch_advanced_index>
<reference name="head">
<action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
</reference>
</catalogsearch_advanced_index>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To prevent search engines (Google, Bing, Yahoo, etc.) from needlessly indexing Magento catalog search results page(s) and advanced search results page(s) add the 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.
You can then test the results on your Magento website with the following URLs:
Search Results page:
http://yourwebsite.com/catalogsearch/result/?q=test
Advanced Search Results page:
http://yourwebsite.com/catalogsearch/advanced/
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:
*You may need to flush Magento caches (Admin->System->Cache Management) to see the updated results