Users have the ability to search on my site. This function renders a search results page that has occasionally been indexed by google and served in SERPs. Normally this is not an issue, but when documents are updated users need to see the most recent information and sometimes stale content/files are index higher than the current information.
The solution would be:
<meta name="robots" content="noindex" /> in the
head of my search results page. My site is templated, including a base template that has
head in it, so the same
head gets served for every page. I can't put a
noindex in there without some sort of conditional logic that checks if the URL is for a search page, which seems real hacky.
I could create the
Alternatively, I could add a
disallow in my
robots.txt, but Google has said this isn't a great method (2nd paragraph, bold). Any insight on this?
Am I stuck using conditional logic in the
head of my base template?