Don’t block your CSS and JS files

July 29, 2015
Comments Off on Don’t block your CSS and JS files

By Thijs de Valk

_67627_Googlebot_cannot_access_CSS_and_JS_files_on_-_Google_Search_Console_Team

Yesterday, we got a question on Facebook that made me feel the need to respond publicly:

are you guys going to have a fix for the Google Bot issue that came up today?
For every site I have using Yoast for my sitemap I got this error from Google Webmaster Tools today:
“Googlebot cannot access CSS and JS files”

Let me first say that this is not something that’s being caused by our Yoast SEO plugin. I’ll explain what this is all about.

Yesterday a notice was sent out from Google Search Console that a lot of webmasters have probably gotten. It basically tells people they shouldn’t be blocking their CSS and JS files. I have to admit, that this made me chuckle a little bit. You might remember a post by Joost from over a year ago stating this exact thing: don’t block your CSS and JS files. We’ve also been telling our Website Review customers for over a year to stop blocking their CSS and JS.

Lets see what the message says. The email looks like this:

In effect nothing has changed much, but Google’s focus on it has definitely increased. Based on the amount of emails we saw people get, this is probably going to start a little fuzz again. Luckily Google provides the webmasters with a nice list on what to do.

It basically comes down to changing your robots.txt so it doesn’t disallow access to your site’s CSS and JS files anymore. If you’re on WordPress, this can actually be done directly in our Yoast SEO plugin.

What also caught our attention is that Google also mentions the fact that your site needs to be mobile-friendly twice in this email. While not necessarily related to the blocking of your JS and CSS files, they wanted to mention this twice. That just makes clear once again that “Mobilegeddon” is still in full motion.

Causes for WordPress sites

As I’ve already mentioned, this notice from Google Search Console is not triggered by anything our Yoast SEO plugin does. Yoast SEO offers a way of editing your robots.txt through WordPress, but we don’t put anything in there.

Also, having a plugin or anything else calling admin-ajax.php, will trigger this email as well if you have /wp-admin/ disallowed in your robots.txt. We feel you shouldn’t have /wp-admin/ disallowed, which Joost explained in this post.

We’ll say it again

We’ve said it before and we’ll say it again: don’t block Googlebot from accessing your CSS and JS files. These files allow Google to decently render your website and gives them an idea of what it looks like. If they don’t know what it looks like, they won’t trust it.

This post first appeared as Don’t block your CSS and JS files on Yoast. Whoopity Doo!

Source:: SEO