Help Me Learn Javascript In 2016

Javascript LogoTaking a page from a fellow Automattician’s goals for 2016, I am making a goal for myself that I’ve put off far too long: learning Javascript.

I’ve built many, many themes for WordPress, but was always able to get by with jQuery and learning just enough to do something simple. However, backtracking and learning Javascript from the beginning will open up many more opportunities for me. I want to be able to do things like:

  1. Contribute to projects like Calypso. With moving to Calypso, and the potential for self-hosted sites to use it, being able to understand it on a deeper level (along with the API) can help me be able to dig out bugs, submit fixes, and work towards enhancements.
  2. Build out home automation controls. My home automation system runs on a Mac Mini Python server. While it’s got a suitable app and prebuilt web frontend, there are a lot of things about it that are lacking that could be solved with even a simple HTML/CSS/Javascript site instead of the built-in stuff. By goal is to access the site via older iPads throughout the house for a “whole house” automation and monitoring solution.
  3. WordPress Plugins. I’ve got a couple of very niche plugins out on the main plugin directory. While they’re very basic, they work well for what I needed at the time, and it seems a few other folks needed them too! I would really like to work on enhancing one of them with some settings, since it enables Jetpack functionality for a theme framework that otherwise would require the user to modify their theme.

Additionally, with all of the frameworks heavy hitters are getting behind (like React), Javascript shows no signs of becoming irrelevant in the foreseeable future.

So, how can you help me? Send me resources. What site/book/course helped you learn Javascript quickest? After the basics, where did you go from there? More importantly, what parts did you struggle with, and what helped you get over the hump?

Help! Googlebot Cannot Access CSS And JS files On My WordPress Site!

Googlebot cannot access CSS and JS files on...

If you received this message this morning from Google Search Console (formerly Google Webmaster Tools), you’re not alone. Google has recently been pushing harder for webmasters to allow crawlers full access to all Javascript and CSS so that they can render a site to determine whether or not it meets mobile standards (among other things). Many WordPress sites (along with the other major CMSs) received an ominous warning that their site was blocking assets, and it could affect rankings. While technically true, many of the sites were only blocking /wp-admin/, where absolutely no public-facing assets should live. For those of you that are in that situation, relax.

However, a number of sites are also blocking /wp-includes/. While it doesn’t seem obvious, there are a number of things that live here which would need to be accessed by users (i.e., crawlers) to render pages properly. For example, Dashicons, the small icons you generally associate with the admin side of WordPress, can often be called by themes for front-end usage. Another major thing that can hinder proper rendering by crawlers is jQuery. Sometimes, themes will enqueue a different version, but by default, it lives in the /wp-includes/ folder. If we dive even further into the issue, we’d see that the built-in emojis and comment reply handling would also be affected.

So, what can be safely blocked? At this point, here’s what a “compliant” WordPress robots.txt would look like (as far as what is safe to block). Of course, you’d want to add in your own sitemap directives and other special cases, but this is a good starting point.

User-agent: *
Disallow: /cgi-bin/
Disallow: /trackback/
Disallow: /wp-admin/
Disallow: /xmlrpc.php

One big word of warning: DO NOT block anything under /wp-content/. You can assume anything blocked here is going to hit you pretty hard eventually, since everything to do with site rendering exists here; plugins, themes, images, and so on. It was popular at one point to block crawlers (like Googlebot) from plugin folders, but given the amount of Javascript and CSS many plugins employ now, it’s a dangerous proposition. If you’re blocking anything here, open it back up immediately.

Questions or comments? Leave them below!

Programming Sucks

You still have to learn more at the rate of about one a week, and remember to check the hundreds of things you know to see if they’ve been updated or broken and make sure they all still work together and that nobody fixed the bug in one of them that you exploited to do something you thought was really clever one weekend when you were drunk.

Exactly. Programming Sucks.