2

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?

1 Answer 1

2

From Google:

For optimal rendering and indexing, always allow Google access to the JavaScript, CSS, and image files used by your website. 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".

2
  • FYI, that page no longer contains that text. In fact, there is no longer any mention of javascript or css.
    – train
    Feb 3, 2023 at 21:07
  • @train Google moved the page that I was referencing. I fixed the link and updated the quote. Thanks for bringing it to my attention. Feb 3, 2023 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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