From “Mobile Friendly” to “Mobile First

If you’re reading this on a desktop browser, you may not have noticed, but we just turned this blog on it’s head, design-wise. Those of you browsing on a tablet or mobile device, however, should be enjoying a much more comfortable reading experience. Now that’s not to say that we’ve been giving mobile the short end of the stick before pushing out the new code, but our approach to mobile has changed drastically since the redesign of this blog early last year and we’re really happy to be able to bring the lessons we’ve learned back here.

Our initial approach to this site involved building out the desktop view as the default layout. We then used CSS3 media queries to “dumb down” the content by removing some page components and reconfiguring some of the content. It worked pretty well, but we were relying on our mobile users to have media query support in their device. Given that our audience tends to have more capable mobile devices, it probably wasn’t an incorrect assumption, but it wasn’t all that kind to people who happen to have less-capable devices. And, in truth, it didn’t sit well with us because it didn’t really jive with the progressive enhancement philosophy I advocate so hard for. That said, the world of media queries was pretty new at the time. 

We know better now.

In the past year, our approach to mobile has become much more nuanced as we embraced the “mobile first” idea Luke Wroblewski has been pushing for (and recently wrote a book about). The idea of “mobile first” is that you optimize your site for use in a mobile context and then layer on additional styles, JavaScript, and content as you find you have more real estate to work with or a more capable device.

In terms of media queries, it meant switching the layout around to be mobile when media query support was lacking and then making tweaks to the styes as the browser’s width exceeded certain milestones (using min-width values rather than the max-width ones we’d been using previously to skrink the site). On the JavaScript end, it meant witholding certain scripts until we knew they’d be useful (the comment preview, for instance, is terribly distracting on a mobile device). These were techniques we’d already put into practice on other sites, but that we had not gotten around to applying here.

The biggest difference most people will see is the visual one. In its previous incarnation, this site only supported 2 resolutions: wide and narrow. It didn’t matter is you were on a tablet or a handheld device; you were getting the mobile layout. Under the new setup, the layout is far more nuanced, adjusting roughly 6 times. Some of the adjustments are subtle (such as relocation of search from the footer to the header as you cross the 570px mark), but others are more substantial (such as the introduction of sidebar content at 651px). Below are a series of screenshots depicting the differences between the two approaches at different milestones.

A comparison of the narrow layout of this blog. The differences are pretty subtle, mostly having to do with spacing.
A comparison of the small screen layout of this blog. Small tablet and Kindle users benefit from slightly larger text.
A comparison of the mid-size layout of this blog. Slightly larger tablets will get a sidebar (as appropriate) and the line lengths are a little better.
A comparison of the wide/desktop layout of this blog. There are some minor spacing differences, but not much else has changed.

Taken altogether, the differences don’t appear that substantial, but given that every device/browser has access to the narrow layout, the reading experience is vastly improved. Note: to get IE to apply media queries in versions 8 and under, we’re using the Scott Jehl’s Respond.js.

So that gives you a pretty good sense of how we’re adjusting the layout based on the device size, but there are a few other niceities going on under the hood that I’d like to share as well. Here’s a round-up:

  1. Our content images are now being served via src.sencha.io, a free web service and CDN from the folks behind Sencha that takes the pain out of serving images based on the device requesting them. To keep the implementation simple (and easily swappable), I wrote an ExpressionEngine plugin to automatically swap images for their src.sencha.io equivalents (EE1 only for right now, but I’ll port it shortly). For more detail on using src.sencha.io, check out this article.
  2. Comments are now loaded via Ajax. I know, it sounds crazy, but it makes sense. By default, we include a link to an alternate version of the blog post template with comments exposed (well, really it’s the same template with an additional URL segment passed in). Then, using JavaScript, we look for that link and replace it with the comments thread after the page finishes loading. You know, progressive enhancement. The overall effect is that it reduces the time it takes to download the page, which means you get to the content you want to read faster. You can check out the code that makes it work over on Github (it’s a slightly modified version of Scott Jehl’s original script).
  3. Our social plugins now protect your privacy. We hadn’t really thought about the fact that every time a script is included from Twitter or Facebook, that can be used to track your movement around the web. Once we realized it though, we decided we needed to change our social links to protect you. As such, we’ve changed the links to work without JavaScript and using images delivered by servers we control. Google+ has been dropped for the time being as they do not seem to offer a consistent destination URL for their +1 service. If they change that or someone can tell us what it is, we’ll likely bring it back.
  4. Better support for services like Readability. We want you to be comfortable reading our content; if you don’t like our layout, that’s fine with us.

What do you think? Did we miss anything that would make your reding experience better on this blog?

PS - If you’re interested, I’ll be giving a full-day Adaptive Web Design workshop in Amsterdam on 29 November 2011, during which I will be discussing these topics and more in much greater depth and mentoring attendees on how to craft truly rich web experiences with progressive enhancement. Tickets are available on EventBrite.

Like it? Share it

Share on LinkedIn

Share on Google Plus

Comments

  1. Really interesting article.
    Now I know on which website I’ll be peeking into the source to find out how to take a responsive design approach…

  2. Very nice! Thanks for the write-up.

    Your Facebook “Like” button is more of a “share” button actually. “Like” without javascript and Facebook tracking code is not possible as far as I know.

    What is the reason you chose sencha.io over a self-hosted solution like for example http://adaptive-images.com/ ?

  3. Thanks for the heads up on “Share” vs. “Like” Florian. With all of the changes going on over at Facebook with regard to the documentation (and functions), it’s been a little tough to keep up.

    As for the src.sencha.io solution… I was intrigued by James Pearce’s mention of it at BD Conf last month. Shortly after a conference, Jason Grigsby posted his rough notes regarding responsive image techniques and, in terms of bang-for-the-buck, src.sencha.io seemed like a clear winner. I contemplated Adaptive Images (going into it, that was my first choice), but as we use a CDN for our images, setting up something like AI was going to require more work to get it up and running than src.sencha.io.

    For what it’s worth, I decided to implement src.sencha.io as an add-on for ExpressionEngine in order to allow us the flexibility to try it out without having to tinker with the content of the site or individual posts. The plugin essentially operates as a filter for <code class=“html”>img</code> elements in the content body and rewrites them to include the necessary src.sencha.io prefix. That allows us to keep the source of each post pristine and will allow us to turn it on and off at will as we experiment with other responsive image options.

    • Aaron Gustafson
    • | #
  4. That plugin seems like a great idea, I’d like to try it out when you’re ready to release it.

    • Aaron Gustafson
    • | #
  5. Great write-up!

    re: non-javascript Google +1.
    There is an issue on the G+ issue tracker—http://code.google.com/p/google-plus-platform/issues/detail?id=50
    Not sure how they prioritise, but starring, commenting on it may help speed up things.

    • Dan
    • | #