If you’re a regular user of Google Console (formerly Google Webmaster Tools), you may have received this warning for one of your websites, as Google has just started sending these out:
“Google systems have recently detected an issue with your homepage that affects how well our algorithms render and index your content. Specifically, Googlebot cannot access your JavaScript and/or CSS files because of restrictions in your robots.txt file. These files help Google understand that your website works properly so blocking access to these assets can result in suboptimal rankings.”
This sounds pretty serious and, at first glance, may worry some website owners. If Google can’t access something and your rankings could be ‘suboptimal’, then that’s bad, right?
Well, don’t worry, there’s no need for panic. This is a very simple fix and is usually caused by a line or two in your robots.txt file. Have a look at your robots.txt file and see if it includes one of these:
Disallow: /.js$*
Disallow: /.css$*
For WordPress sites specifically, it might include:
Disallow: /wp-content/
Disallow: /wp-content/themes
Disallow: /wp-content/plugins
If any of these lines are present, remove them. They’re basically telling Google it can’t access files with the extensions .css or .js and, for WordPress, it’s saying Google can’t look in the folder /wp-content/ or the themes and plugins folders.
You can test if your work has been successful by going to Google’s ‘Fetch as Google’ tool in Google Console, selecting your website property (if you have more than one) and clicking the ‘Fetch and Render’ button.
This will take a few moments before it is ready. Once it has been completed, click on the button with the green tick to see the results. If it has worked, you should see your website ‘as Google sees it’ displayed pretty much the same as how users will see it (with the CSS and JavaScript displaying correctly).
You can also check the results in the robots.txt Tester in Google Search Console to ensure your edits have been crawled by Google.
- Win two hospitality tickets to watch Liverpool v Toulouse at Anfield - September 25, 2023
- Wanted: Web Developer - June 13, 2022
- Facebook adds ‘automatic invitations’ to invite page followers to your group - May 17, 2021
RT @EngageWeb: Google Console’s warning about blocked CSS and JavaScript files – what should I do?: http://t.co/xbgJdez5g7
RT @EngageWeb: Google Console’s warning about blocked CSS and JavaScript files – what should I do?: http://t.co/xbgJdez5g7