Blocking Javascript and CSS Files in Robots.txt

I have my sites hooked up to Webmaster Tools by Google, to help me look at different aspects of my sites. I am also used to using it for submitting my sitemaps and checking them for SEO purposes. One of my other sites, DesignCrawl, apparently blocks its javascript and CSS files in the robots.txt file. This is frowned upon, so I decided to look into why, and how if can (if I should) fix this issue. It turns out that most of the people receiving these notifications are on WordPress sites. DesignCrawl is a WordPress site, so I thought I would look into it.

Blocking Javascript and CSS Files in Robots.txt

Robots.txt File

Now, I thought to myself that I could hop right into my FTP and edit my robots.txt file and get that issue fixed in a matter of seconds. After doing some research, I confirmed my suspicions that many WordPress themes have CSS and javascript files in the includes folder of the theme itself. Some fear that it may be a possible security risk to for hackers to gain access to your site if they know the file path of your includes folder.

Why You shouldn’t Be Blocking Javascript and CSS files in Robots.txt

It’s simple. Google now looks at how your site works on a mobile device. it needs the javascript and CSS files to understand this properly. Most responsive frameworks are dependent on CSS, javascript, or both. If you block access to those, Google can’t see the site properly. If your site doesn’t appear to be mobile friendly, you may not be penalized, but your site may not rank as high as it could. Even worse, your site may not show up in mobile searches at all. Blocking Javascript and CSS Files in Robots.txt is a bad idea if you want to maximize your exposure to a mobile audience.

Are you running into this issue? If you are, or you need help with your WordPress site, leave a comment below and I’ll try to help you. Don’t worry, it sounds more serious than it actually is.