1

I have a website built with Gatsby.js. After building it, I receive a lot of static HTML files, with React app bound to them. All content is in HTML already, JS is needed for some fancy transitions, forms and analytics. What I want to do, is loading only some (or maybe even none) of the scripts when Google bot requests the page.

As I read here, you are fine as long as you're producing similar content for Google bot and for real users (and HTML content is exactly the same for both in my case).

But it is also said (sorry, cannot find the link where I saw this) that your tactic may be considered shady if you have any sort of conditions like if (userAgent === "googlebot") then ... else ... in your code (and this is actually my intent).

So my question is, will Google ban me for this or not?

2

From Google:

For optimal rendering and indexing, always allow Googlebot access to the JavaScript, CSS, and image files used by your website so that Googlebot can see your site like an average user. If your site's robots.txt file disallows crawling of these assets, it directly harms how well our algorithms render and index your content. This can result in suboptimal rankings.

The answer is that Google won't ban you, but you might see "suboptimal rankings".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.