Forums › Forums › Search & Filter Pro › How to NoIndex Search result pages?
Tagged: V3
- This topic has 13 replies, 2 voices, and was last updated 6 years, 3 months ago by Anonymous.
-
Anonymous(Private) August 14, 2018 at 10:33 pm #185612
Would I need to:
1.) Duplicate the template file I am using to display results from my theme.
2.) Rename it to “custom-power-search.php” for example.
3.) Add the code to the template so the “noindex” is enabled in this custom template.
4.) Add that modified template to the child theme.
5.) Set the “Custom template?” option in the plugin to yes and enter “custom-power-search.php”?Would that work?
Thanks
Trevor(Private) August 15, 2018 at 9:02 am #185624That is one way to do it. Another is to simply install Yoast SEO:
https://yoast.com/blocking-your-sites-search-results/
Which is what I do on my personal sites.
Anonymous(Private) August 15, 2018 at 1:40 pm #185649Hey Trevor.
Thank you for your reply.
I do have Yoast SEO installed and while it does block search results from the built in search in my theme, it is not blocking search results for the S+F results. I am seeing 230+ urls when I use the “site:”insert-doman-name” inurl:”insert-part-of-custom-slug-in-power-search-URLs”” operator searching on google.
You can confirm that Yoast SEO does noindex S+F URLs when using the “As an archive” display method with a custom slug?
Thanks!
Anonymous(Private) August 15, 2018 at 2:01 pm #185657Thanks Trevor.
Do you know what code I would need to insert into the duplicated template file and where in the file exactly? For example where and what code would I add in the search.php or index.php file to have the noindex added to the search pages generated by S+F?
Thanks!
Trevor(Private) August 15, 2018 at 2:12 pm #185661It might be better to do this in the functions.php file of the child theme, maybe something like this:
add_action('wp_head', 'noRobots'); function noRobots() { if(strpos($_SERVER['REQUEST_URI'], '?_sf_s') !== false) { echo "\t<meta name='robots' content='noindex, nofollow' />\r\n"; } }
That might work better.
Trevor(Private) August 15, 2018 at 2:37 pm #185667Search and Filter passes the URL as a query string that always starts like that. It will only show in the URL bar if you make the search URL bookmarkable (one of the settings in the form), but it is there (hidden) if you do a search. That means your results page unfiltered is still indexed, but not when a search is done.
-
AuthorPosts