Introducing the Readability Button Module for Drupal

Spend any significant amount of time reading long articles on the web and you get distracted. Distracted by sidebars and insets full of links and animated graphics, many of which are advertisements. Distracted by badly set typography. Distracted by "next page" links at the bottom, forcing you to wait for the next part of the article to load as the publisher gets another increased statistic to sell. 

Enter Readability. Developed by Arc90 as an experiment, Readability started life as a bookmarklet and browser extension designed to improve the reading experience. In addition to decluttering distracting constituents of a web page, the bookmarklet offered a consistent look that stripped an article to its essential element, the text. After Arc90 released the bookmarklet as open source software, Apple's integrated the code into the Safari web browser. Subsequent to that the company changed direction with Readability in January of this year and started a web service for both website publishers and readers. While keeping the core service of simplifying articles for easier reading, with the new Readability, publishers of any type on the web — from magazines with multiple contributors to single editor blogs — can integrate Readbility into their website and optionally receive payments for their work from readers who sign up to contribute.

How Readability Payment Works

Publishers first must claim their website by adding a special code to the HTML header, which they can remove after verification. Using their own Readability accounts, readers can contribute a monthly fee that they, the readers, individually specify. (Publishers have no say what readers have to contribute, though Readability sets the monthly minimum at $5.) Readers' money first goes to Readability, who take a 30% cut. Readability then divides the remaining 70% amongst the publishers that readers, while logged into Readability, read through the service. As a simple example, let's say a reader only reads two online publications, The New Yorker and The Bygone Bureau. If a reader contributes $10 per month, and in the span of a month, uses Readability to read 6 articles from The New Yorker and 5 articles from The Bygone Bureau, Readability takes its $3 cut and The New Yorker gets $3.82 ($7 divided by 11 total articles, multiplied by 6 New Yorker articles) and The Bygone Bureau gets $3.18 ($7/11*5).

Readability buttons, as they appear on websites, typically offer the reader has the option to send the article to Readability and come back to it later ("Read Later") or immediately convert the article to Readability's simplified version ("Read Now"). Some tools that do 'read later' functionality, like Instapaper, can, after reading through the app, send the link to Readability so that it is counted towards the reader's monetary contribution.

Publishers do not need to claim their website or receive any payment in order for readers to use the part of Readability that converts article to pleasant-looking text, nor do readers need to pay Readability to convert distracting pages. The publisher-contributor model constitutes a new way for publishers and writers to make a few bucks on their creation and for readers to keep good writing coming without have to put up with (as many) advertisements. One publisher confided in me that "nobody's getting rich off it," referring specifically to Readability, but Readability at leasts represents an opportunity for innovation in the ways publishers, writers and readers interact and support each other.

Readabilty Button for Drupal

Screenshot of a Readability 'Read Now | Later' button on an example node in Drupal

Since I work primarily with the content management system Drupal, and wanted the functionality not only for my site but for other Drupal sites, I've developed a module called Readability Button. "Without this module, site maintainers would have to edit their theme directly, introducing code that they need to maintain. Instead, they can turn on the module and change settings, and if they want to discontinue Readability integration, can simply disable the module. Readability Button features the following:

  • Enable the button on a per-content type basis. Also a permission to show the button on nodes to certain roles.
  • In the module configuration, temporarily add the verification string (the full element provided by the Readability web service) without editing your theme. You can disable this after you've verified your domain.
  • Configure whether to show only on the individual node view or also on lists (such as the blog page or taxonomy views).
  • Optional Print, Email, "Send to Kindle" buttons.
  • Modify the colours of the foreground and background using hexadecimal colour codes. Optional integration with jQuery Colorpicker.
  • Change the orientation of the button from horizontal to vertical.
  • If a reader is logged into their Readability reader account, and the reader is a contributor, clicking the button sends a portion of their contribution to the site's publisher.

If you add the module to your Drupal site, I encourage you to make a feature request and submit bug reports in the issue queue.

Imagining a 2.0 branch

The module as described as above has some limitations:

  • Once you add it to a content type, all nodes of that content type receive buttons, no matter how short
  • If you allow the button on lists, it appears on all lists. that includes views, taxonomy term pages, blogs, etc.
  • The weighting of the button is somewhat of a kludge

A 2.x branch of the module, which only exists in my head, comprises of the following features:

  • Make the Readability button a field in the Drupal 7 sense. This would enable many things for "free":

    • flexible placement of the field in content types, using the per-content type field settings
    • Views integration, meaning with any list you can override settings to show or hide the Readability button
  • Readability API integration, meaning authentication and management of your Readability publisher account for websites and reader accounts for site members
  • If the website uses the Domain Access module, then each site could conceivably have its own 'domain' in Readability as well. Imagine individual bloggers on a Drupal site as a publisher who gets the 70% cut from Readability

Beyond the Module

Just a Gwai Lo currently uses the Deco theme, and, in order for Readability to reliably convert my own website to the clutter-free text, I made some slight changes. In particular, I needed to ensure Readability correctly picks up on article titles and dates. Per Readability's recommendations to mark up articles in the hNews microformat, I've added an entry-title class to my


h2> tags, necessitating modifications to the theme's template.php and node.tpl.php files. I also added a element wrapped around the date for blog posts. The right way to do all of this would be to find a way to modify the theme elements in a module, though I think the only option available to me is to maintain a sub-theme.

The Music Must Carry On, But Cannot Carry On

Lars Svendson: Pop music is based on the banalities of everyday life, and it attempts to convert these banalities in such a way that they make a break possible with everyday boredom. In pop music a hope is formulated that these banalities can become something more. For example, that a form of love exists that can release us from life's heavy burdens or burdensome lightness. And in the absence of thls release, pop music can remove some of the excess time, for 'there's still time to kill' (Up Against It). As long as the music lasts, we escape boredom, but, sooner or later, the music will stop. In the absence of meaning, the club becomes a place of refuge, and in dancing, embraced by the music, we gain a foretaste of a kairological eternity: 'When you dance with me, we dance forever' (Hit Music). But the Pet Shop Boys are also well aware that, ultimately, this is escapism: 'Live a lie, dance forever.' It gives some consolation, but no solution. The aesthetic revelation - like the anaesthetic revelation - is at most temporary. The Pet Shop Boys' album Bilingual takes us from an opening question in Discoteca: 'is there a disco around?' to the final song Saturday Night Forever, where one has entered the club. But as the penultimate track says: 'I know that it's not gonna last forever" They have a Schopenhauer-like belief in music but, like Schopenhauer, know that it will not last. The music must carry on, but cannot carry on, just like Beckett's voice has to carry on despite the fact that it cannot. When one is not out clubbing, there is nothing to do but to try to live an everyday life, in boredom and waiting, yet with hope. Music, or anything else in the aesthetic dimension, is not a solution in itself.

Where Things Disappear Into Pure Functionality

Lars Svendsen: Anthropocentrism gave rise to boredom, and when anthropomorphism was replaced by technocentrism, boredom became even more profound. Technology involves the dematerialization of the world, where things disappear into pure functionality. We have long since passed a stage where we could keep track of technology. We scurry along behind, as is perhaps particularly clear in IT, where hardware and software have always become obsolete before most of the users have learned how to use them.

That "Everything" Is Somehow Trivialized

From a review of Alone Together: Why We Expect More from Technology and Less from Each Other by Sherry Turkle: Turkle points out, when we have no privacy we lose the ability to privilege some thoughts and actions over others. She quotes Eric Schmidt, CEO of Google, who says that "if you have something you don't want anyone to know, maybe you shouldn't be doing it in the first place." Like many others, he ignores the possibility that there might be privacy without shame or crime. We might want to keep things to ourselves for any number of reasons; when we "put everything out there," that "everything" is somehow trivialized. Turkle quotes a girl who claims there's nothing much to know about her; "I'm kind of boring." Will the loss of privacy lead more people to dismiss themselves as boring?

The Concomitant Penetration of Every Moment By the Potential to Create

The somewhat recent release of the Situationist iPhone app, which encourages nearby strangers to playfully interact, sparked a revisiting of Social Acupuncture by Darren O'Donnell. And there it is, on page 79, my first introduction to the Situationism movement. Here's the paragraph in question from Social Acupuncture: Art's drift out of the field of representation and its move into relational forms, as well as the ever-increasing economic expediency of culture in the so-called creative economies described by [Richard] Florida and others, have created a proliferation of avenues through which to distribute artistry. The Situationists may have had some fantasies about the liberating potential of art as an everyday lived experience, where all moments of one's life become a creative opportunity; now we have the concomitant penetration of every moment by the potential to create, and in turn, to work. Hardt and Negri point out that capitalism is always innovating in response to resistance against it. The freeing of labour from the Fordist regime of the factory floor was imagined, at first, to be a positive movement, but capitalism easily incorporated these innovations. The idea of working from home was once an appealing notion, but now it brings with it the opportunity to never escape work, to field emails at all hours, to be lured to the humming for just another minute or two of labour.

Some Wins

Early last year, around the time of DrupalCon San Francisco, Packt Publishing approached me to serve as technical reviewer for a book. Several Microsoft Word documents and 7 months later, the dead trees edition of Drupal Theming Cookbook by Karthik Kumar, arrived at my doorstep, complete with an acknowledgement of my work inside the front cover. In the hopes of branching out a little, I also received a complimentary copy of Django 1.0 Website Development by Ayman Hourieh. Over the course of a month in December 2010 it served as an excellent guide to completing one's first app, with little or no Python knowledge required, but taking the 'dive right in' approach. (Anything that didn't work with Django 1.2 was a quick Google search away. I have sticky notes at every point at which it differs from the current version as of this writing.) I hope to ship an app based on the example sometime this year. At the end of last November, I helped instruct at a community-based clinic teaching a basic-level introduction to the Drupal CMS. Based on notes from the Seattle Drupal Clinic held in 2009, several members of the Drupal community and people new to Drupal converged at the FCV office in downtown Vancouver. We covered modules, content types, image manipulation, and for my session at the end, the Views and Block modules. We the trainers learned a lot from that first session, and it seems like the same can be said about the participants. My thanks go to everybody involved. It's an initiative I'd like to participate in again. A third win involves getting back into the Drupal support game. You can find me on the #drupal-support IRC channel when things slow down at work, and recently on Stack Overflow's Drupal-related questions. While having reservations about not tracking the forums for support, I will go where the people are. Since some people have asked, since June of last year, I've been working for OpenRoad Communications, a web services company based in Gastown. They're technology-agnostic, and when they had a couple of Drupal projects come their way, it made sense to have me on full-time. Separately from web services, they created a product called ThoughtFarmer, which they bill as a social intranet. (It might be tempting to make a connection between Drupal and ThoughtFarmer, but other than my sitting next to the development team, rest assured the two are not related.) Since months can go by between my mentioning my employer, it's probably best to refer to LinkedIn or my resume for my latest professional status.

He Would Rather Pay the Taxes in Full

Zadie Smith: “Upstairs, Alex picked up the case from his trip and emptied the contents into the bed. The clothes he lifted in one stinking bundle and dropped into the bathroom's washing basket. Books he put on the floor and then kicked into a reasonable pile in a corner. He filed through the paper by hand, throwing every other piece of it into the bin including all receipts, for he had long ago decided that he would rather pay the tax in full than allow himself to be the type of man who remembers a beautiful day by the expenses he ran up on it.”

Attending DrupalCon San Francisco April 19th to 21st

Starting with the community site Urban Vancouver, then as the support cowboy for Bryght and Raincity Studios and now with an independent practice, I've enjoyed all of my almost 6 years with the Drupal community. In a couple of weeks, I'll fly to San Francisco to attend my first DrupalCon. With my flight and hotel booked, conference ticket registered, and a ticket to a Major League Baseball ballgame ticket received in the mail, I look forward to the 3 full days of sightseeing in the Bay Area, including the plans to take a tour of North Beach and ride San Francisco's historic streetcars. The conference itself will present me the opportunity to meet many of the people working on the open source CMS that I admire. I'm looking forward to attending sessions and hanging out in the lobby, and in the evenings, drinking some sweet delicious beer with colleagues. Tuesday night sees me riding BART out to Oakland-Alameda County Coliseum for the first time in some twenty years where I saw my favourite Blue Jay of all time, Jesse Barfield, sock a dinger. This time, without a team to cheer for, I hope to soak it all in, arriving as early as possible to catch hitting and fielding practice, then taunt and boo the Yankees until my throat is sore. Leaving the conference early means missing some fantastic-looking DrupalCon sessions from Narayan Newton and Greg Knaddison. If the baseball gods get angry and rainout the A's game, you'll see me at one of those two sessions.

Vancouver Magazine's Instant Office Cafés on a Google Map

Today Scout Magazine and Beyond Robson linked to my Google Map of Andrew Morrison's 50 favourite places to eat in Vancouver. Also today, Vancouver Magazine published a list of 5 cafés in Vancouver (and North Vancouver) where you can setup shop for a virtual office, and they too did not include a map of any kind. Since there are only 6 places listed, this time I entered the addresses in, made a spreadsheet, converted it to KML, and imported it into Google Maps without any programming. The result (shorter URL) is below, with phone number, address and hours but without the writeup from Vancouver Magazine. It took me half an hour to create.

View Instant Office in a larger map

Andrew Morrison's 50 Favourite Things to Eat & Drink in Vancouver on a Google Map


Rob pointed to Andrew Morrison's favourite things to eat & drink in Vancouver. After a few hours of programming and manual data manipulation, I was able to provide a Google Map of Andrew Morrison's 50 favourite things to eat in Vancouver that Rob requested.


Sitting around all week looking for a programming task to sink my teeth into, Rob Vanmega posted a link to Andrew Morrison's favourite things to eat & drink in Vancouver. Not knowing much about the food scene in Vancouver, and not identifying as anything resembling a foodie (is there a word for us?), I nevertheless took up Rob's challenge to make it into a Google Map. Seeing this as an opportunity to scrape off some of my programming skills' rust, I set about to parse the list into a format that Google My Maps could import. It was way harder than it needed to be.

View Andrew Morrison's 50 Favourite Things to Eat & Drink in Vancouver in a larger map

Thankfully, Andrew Morrison crafted his list in a consistent, structured format. Not semantic by any means, but he wrapped each restaurant name and food item in <strong> elements, and the address, phone and website were all inside parentheses. Using TextMate to inspect the HTML list (surrounded by paragraph tags), and futzing around with a couple of regular expressions, I removed the surrounding text and get to the heart of the data. A couple of passes later, the data went into a CSV file and, after some manual manipulation by both Rob and myself, I came out with a decent set of information. Unfortunately, Google Maps wouldn't work with just the address, but had to use longitude and latitude.

That's where came in. With a useful, not free (but very cheap) API, I could feed in all 50 requests and, after a couple of test runs, got the points on the map. After reformatting the CSV (yet again), I piped it through a CSV to KML converter (a cross-platform application that violates quite a few Mac OS X interface tenets) and imported the resulting file into a custom Google Map.

The result of all that work, about 3 hours worth of manual manipulation, programming and converting, we have a Google Map of Andrew Morrison's 50 favourite things to eat in Vancouver. I can't emphasize how much that this is a beta version of the map, since I haven't verified that every location is correctly situated. Feedback is welcome: send me a note if you notice something amiss, and I'll either correct it or add you as a collaborator.

Rob said in his link that “if someone lays this over a Google map, I’ll happily hit all 50 things by year’s end.” He has just over two and a half months.

Show Google AdSense to Visitors from Search Engines Only Using Drupal

Unbeknownst to people who visit my website directly, Just a Gwai Lo has served Google AdSense ads for some time now. Very early on I came to the conclusion that showing automatically-generated content-aware ads on personal sites was tacky, since those visiting directly were likely those who wanted to develop a personal relationship, no matter how loosely defined, with the author. That applies to the relationship I want to build with my readership as well: if they visit the site directly in a browser of subscribe to a feed, they shouldn't have something hawked at them.

People visiting through search engines, however, get no such treatment. They're likely people I don't know and, based on what people search for—and don't find on the site—don't want to have a relationship with. So anybody visiting in from one of the major search engines would see a Google AdSense ad, and over the years I've made enough to help fund some small vacations to the United States. (Since Google pays me in American dollars, it goes in my USD account, which I then withdraw for trips south of the border.) Nothing spectacular, and definitely not worth the amount of investment I put into the custom PHP script which looped through a list of domains returning TRUE if one of those domains were Google, Windows Live Search (as it was known then), Yahoo! and some others. Now I use Drupal, the following contributed modules and a one-line conditional in the block display filter to show ads to people finding my site that way.

  • AdSense, with the component modules "AdSense core" and "Managed ads" enabled.
  • Search Engine Referer API, which returns FALSE if the referrer is not a search engine and an object (essentially TRUE) if it is.
  • The following line of PHP in the "Page specific visibility settings" for the ad's block: I could have written a ternary operator, but I sought clarity in this case.

After my next payment, I'll disable this feature as part of an effort to simplify my Drupal install. This will cut down on the number of updates needed and ever so slightly decrease the load on the server. It's never been worth displaying them based on the time invested in this, though I can say the money plus experience with the advertising system in general did offset it a bit.

Try To Fix

Doug Stowe: I found just a bit more satisfaction as a fixer rather than consumer. To apply just a few moments of time in careful observation can save hours of time shopping, hours of time earning money to be wasted, and hours of time being frustrated by buying things you really don't even like in the first place. So before giving up on old stuff, be brave. Try to fix. You really can't make matters worse, so there are no risks.

Developmental release of Pirate module for Drupal 7 available

Three weeks until Talk Like a Pirate Day, and next week the Drupal project freezes its code in anticipation of the version 7 release of the CMS. In anticipation of that, I've updated the Pirate module, which turns all contributed content on a Drupal-powered website into pirate-speak for just the day of September 19th, to include a developmental release for the Drupal 7 platform. I'd like for people to test it out, and in order to do so on a day other than September 19th is to either modify the date in the following code of the module or remove it altogether. if (date('md') != '0919') { return $text; } I see that similar code to my module has been included in the Dialectic module, which supports other novelty input formats. I may be convinced to officially merge my work into that project in the future, though my module differs in that it activates on only one day a year. Any issues specific to the Drupal 7 conversion can added be to the issue for that. One sticky, longstanding issue that I could use some help with and affects all versions is a bug involving URLs that contain 'ing'. I pledge that Pirate will have a full Drupal 7 release on the day that Drupal 7 is released. #D7CX:

Brightkite Meetup Recap

Almost a month ago, I organized the first ever Vancouver Brightkite users meetup, and we got 5 people to come out, as well as some people who had Brightkite accounts but may not have known there was a meetup. My tentative attempts to lure people from the GeoWeb 2009 conference failed miserably. I was able to distribute some t-shirts and stickers, and still have quite a few left for those who are interested. If you're in Vancouver, email me your shirt size and I can hook you up. One person was out of town during the official meetup, though she and I did eventually have coffee (she resides in my hometown, so we had at least that in common). A few others expressed interest in a subsequent meetup, so that might be something we can do in the near future when it it starts getting dark earlier. If you're a Brightkite user and want to express interest in a future meetup, post a comment in the Brightkite meetup t-shirts and stickers and beer photo.

Vancouver Is Not Serious About Rail

(Cross-posted from Countably Infinite as part of Blogathon 2009.)

Canada Line 3:59 PM

Looking at Wikipedia's timeline of the Canada Line decisions, we see that TransLink canceled the project twice and we know that in order to cut costs, InTransitBC changed the construction from bored tunnel along much of Cambie St. to cut and cover. We also know that the Canada Line trains are completely incompatible with existing SkyTrain tracks along the Expo Line and the Millennium Line, and even if they were compatible, the system was never designed to connect trains at Waterfront Station. (An engineer at an open house years ago, before construction even started, assured me that they could—or would—not build a tunnel with the radius required to connect.)

Visiting the Vancouver City Centre station as part of the open house today (my set on Flickr), I was shocked with the visual reminder of something I knew already: that trains would not be nearly as long as the existing SkyTrain systems. Roomier, as Jim Pick notes, but shorter. The stations constrain the size of the trains to the two car trains, where on the Expo Line and Millennium Line, 6 car trains can fit snugly, as we found out last winter. The dirty trains and security guards killing me with kindness, asking me in a friendly way where I was going when I just wanted a picture of the tunnel, dispel any enthusiasm I might have had for Canada Line and rail in general in the Lower Mainland.

Dirty train on display at Vancouver City Centre Station

Longish articles in The Walrus and The Tyee by Monte Paulsen detail how Canada missed its chance for a culture where rail transportation co-exists as a first-class citizen in our supposedly modern nation. The humming and hawing about a second train from Vancouver to Seattle illustrates how various levels of government don't want this anywhere near their electoral constituencies. The recent "cancellation" of the Evergreen Line further puts to rest any claim that the Lower Mainland at its various levels of government is serious about rail. For this fan of rail transportation (I bought the Microsoft Train Simulator game at the height of the popularity of first-person shooter Half Life: Counterstrike) I have to ask myself: do I wait for Vancouver and its surroundings to seriously commit to rail as a viable mode of transportation around and inside the city, or do I move to a metropolitan area that is already serious?

Thanks to Karen for letting me write on her blog. I know she's passionate about this city and its public transit system, and it comes through on her transit blog TransLinked. I love this city and its buses, trolleys, passenger ferries and yes, its various trains, including the often overlooked and underrated (and popular!) West Coast Express. I've even gone so far as to take a trip out to Port Moody for no other reason than to ride Vancouver's commuter rail. In my capacity as administrator of the Vancouver Transit group on Flickr, I want to document and show my respect and awe for TransLink's network of transportation methods, and I want the city and its environs to seriously consider streetcar, elevated and below grade rail as well as extensions of the WCE. I'm looking forward to what comes out of Vancouver's demonstration streetcar project during the Olympics, and see it as the right step towards a serious approach to mass transit in the city proper and the Metro Vancouver region. I don't have any other signs of this, however with the Canada Line and other proposed extensions to SkyTrain.