PHP: do not display date if user agent is a crawler

My website has blog-style updates on the homepage, but the website is definitely not a blog. It is indexed by Google and the last updated date is displayed in the search engine results summary. I don't want the date to appear on the search results page. I've found other posts related to this issue, suggesting rendering the date with javascript after the page has loaded (tried it and Google still gets it), or for rendering the date as an image (would prefer to avoid this).

I was wondering if I could just use PHP to determine if the user agent is a Google bot (or bing, etc.) and in those cases just not display the dates on the messages. Is there a downside to this? Can search engines find out that I am giving them a modified version of my site and will they punish me for doing so?

+3


source to share


2 answers


Please don't do this . This is considered an SEO black hat and you stand a chance of getting penalized.

Google doesn't just visit your page as GoogleBot, it also visits a regular browser and compares versions. Since the date of creation counts in the rankings, what you do will be considered good.



If you really want to do this, do it on your regular page as well, so you will have less chance of getting penalized, but with that your visitors will have a worse user experience.

+1


source


here are some suggestions for your question, how to detect search robots: How to recognize bots from php?



The downside is that the preview will be different in search results

0


source







All Articles