Many webmasters have been receiving a similar message from the Google Search Console over the last few days:
Googlebot cannot access CSS and JS files on [your website]
The message explains that Googlebot cannot access the CSS or Javascript files on your website, which may negatively affect your search rankings. The Google Search Console message explains that the issue is occurring “because of restrictions in your robots.txt file”. The message notes that failing to fix this issue may “result in suboptimal rankings”.
For WordPress sites, this fix is fairly simple. Follow these instructions to allow Googlebot to crawl CSS and Javascript files on your WordPress website:
- Add plugin (WP Robots Txt) & activate
- Go to settings –> reading
- In the robots.txt content box, copy & paste the following:
User-Agent: Googlebot
Allow: .js
Allow: .css
5. In the Search Console, test the new robots.txt file & submit
Following these steps will allow Googlebot to crawl your site’s CSS and Javascript files. It is important to allow Googlebot to crawl all content on your website so that your site can index as strongly as possible.