If your WordPress site also displays the warning message as a “Googlebot cannot access CSS and JS files”. In this message contain links and instruction to fix the issue. But it is not easy to follow those instructions.
Through this article, we will provide for you brief knowledge and causes for the “Googlebot cannot access CSS and JS files” error in the WordPress and troubleshoot method to fix the issue.
Why Google needs access to CSS and JS files?
For the user-friendly website which has features such as fast, has good user experience, Google decides to give better ranking to those sites. Google wants to access to site’s CSS and JavaScript files, to measure the user experience of a website.
To access any CSS or JS files, WordPress does not block search blots by default. But it may be accidentally blocked when owners try to add extra security measures or by using a WordPress security plugin.
It may be affected to the SEO performance of your site by restricting the Googlebot from indexing CSS and JS files.
Now we will see the way of finding this kind of file and unblock them.
How to give Google access to your CSS and JS files
First of all, you have to identify the files which are Google is unable to access on your website.
Through clicking on Crawl > Fetch as Google in your Google Search Console (formally Webmaster Tools), you can observe whether the way of the Googlebot sees your website. After that click on fetch and render button. (You need to do this for both Desktop and Mobile.)
When it fetched, there will be appear the results. It will be display what a user sees and what the Googlebot sees when it loads your site, by clicking on it.
If you are able to notice any difference between the two screenshots, then you can identify that Googlebot hasn’t the opportunity to access CSS and JS files. In here, you are able to identify the links of CSS and JS files which are unable to access.
There is o option called as blocked resources. You can go to it through Google Index > Blocked Resources. When you go to that, there will be display a list. Through that you can identified the blocked list.
Through clicking on each resource, you can see the links to actual resources that cannot be accessed by Google bot.
Most of the time, the issue occurs by CSS style and JS files added by the WordPress plugins or theme.
Now you have to edit the site’s robots.txt file. Through that, it can control the Google bot sees.
You have to connect with the FTP client to edit it. You can find the rodot.txt file in the root directory of your site.
If you use the plugin which is Yoast SEO, then you can edit the robots.txt file within the WordPress admin area. For that you can go to the SEO > Tools page and click on the File Editor option.
You can mostly see that your site has disallowed access to some WordPress directories such as:
User – agent: *
Disallow: / wp - admin /
Disallow: / wp – includes /
Disallow: / wp – content / plugins /
Disallow: /wp – content / themes /
Now, you have to remove the line which is blocking Google’s access to CSS or JS files, it located in your site’s front end. Normally, these files are located in the plugins or theme folders. Now, it should b e want you to remove wp-includes, It will be able to call scripts located in a wp-includes folder such as jQuery for the WordPress plugin or theme.
In some scenario, the user cannot see that their robot.txt file is empty and some situation there does not exist robot.txt file at least. If there is no available robot.txt file in your Googlebot, then it is automatically crawled and indexes all files.
Then why are you seeing this warning?
Sometimes, it may be proactively blocking access to default WordPress folders for Google bots by some WordPress hosting provider. Through allowing access to blocked folders, you can over rid the robots.txt.
User – agent
Allow: /wp- includes/ js/
When you complete it, now you save your robots.txt file. Now visit the fetch as Google tool, and now you can click on fetch and render button. After that, compare your fetch results. If you done properly, it should be disappear the most of blocked resources issues in your WordPress site.
This is the end of the article. So we think that this article is helping you to get the knowledge regarding “Googlebot cannot access CSS and JS files” error in the WordPress site. And we indicate the simple way to resolve the “Googlebot cannot access CSS and JS files” issue. So, think that those methods are understandable for you. If you also facing to the “Google bot cannot access CSS and JS files” error in the WordPress, you can go through this article.