No one’s listening

Comments. Over the past decade, the Internet has become inundated with them. Ten years, ago, the concept of a “blog” was considered cutting edge, by those who even knew what they were. Now, they’re everywhere, and their general format — a dated archive of topical posts by one or a small number of authors, each of which is trailed by a string of reader comments — has become the standard structure for most news and information websites.

But… comments. Oh, comments. They help turn a one-sided online journal into a thriving community of engaged individuals. Or not. By now, the true nature of most comment threads — a bunch of morons yelling “FIRST” followed by a bunch of even bigger morons ranting at each other without ever engaging — is so well-known, so obvious, that it’s boring even to mention and somewhere between tiresome and excruciating to experience.

So, how long will it be before comments go the way of Internet Explorer 6 and Flash? (Oops… have I spoken too soon?) I think the day is coming soon.

Comment ça va?

Many prominent blogs, Daring Fireball for instance, have long eschewed comments (although the persistent commenters have found a way around that). Others are following suit. And now, it’s easier than ever for frustrated readers to take things into their own hands and silence comments wherever they go online.

I can’t tell you how tempting shutup.css is. I’ve spent more time angrily scrolling through insipid comment threads than I care to remember… but it’s driven me to rant before.

Jumpin’ Jack Flash

But, just like Flashblock (or, for you Safari users, ClickToFlash), I think if I were to try it, I would quickly go back, no matter how annoying the comments are.

Don’t get me wrong: I feel the same way about comments as I do about Flash. Both have potential, but far more often than not they are just intrusive and annoying rather than useful. I tried Flashblock for a few days last week, and I was happy not to be intruded upon with overlaid advertisements, intro animations, and other bandwidth- and time-wasting nonsense. But turning off Flash also meant I had to click an extra button to watch most videos, and even worse, to upload files on my WordPress blogs… not to mention the client sites I’m developing that have JWPlayer and YUI Uploader embedded in them. So, as much as I want to be rid of Flash, and as content as I am not to have it in iPhone OS, I decided I needed to turn it back on in Firefox on my MacBook.

The same goes for comments, but I don’t even need to try shutup.css to know I wouldn’t want to keep it. Sure, I hate the comments on most news and tech sites I read, but I like them on my own site, and I like them on the sites that I want to comment on.

Turn it on again

So, with both Flash and comments, there are proponents and opponents. It seems in the recent dust-up over Flash (or the lack thereof) on the iPhone and iPad, the most fervent supporters of Flash are Flash developers, or people who just hate Apple. And with comments, well, it’s pretty obvious: people who like comments (or, more specifically, like to make them) want them, and just about everyone else doesn’t. It’s clear to me that comments rarely add value, and they often detract from the sites they’re on. On the other hand, allowing comments on my sites has for the most part added value to them, and, critically, commenting on other sites has driven traffic to my sites.

Does this mean that the act of commenting is purely, or at least primarily, an act of shameless self-promotion? Perhaps. I wouldn’t post a comment if I didn’t think the comment had merit on its own, but I’ve also consciously posted comments on some sites knowing that doing so was a prime opportunity to bring some of those sites’ readers over to my sites.

And in the end…

By now it is becoming increasingly apparent to me that both Flash and comments are facing their demise. At least someone at Adobe gets it: Adobe is not in the Flash business, they’re in the “helping people communicate” business. Flash has been a tremendous tool for allowing people to communicate online for a long time where open standards have lagged behind. But by its nature, Flash is fundamentally opposed to what the web is really about. Nobody “owns” HTML or CSS or JavaScript. They’re open standards, and they’re the foundation of the web. Proprietary, closed technologies limit the web’s growth. Flash requires a plug-in (even if just about every computer comes with it preinstalled); Flash files are a “black box” to search engines and text-based systems; the technology resides in the hands of a single company whose fate will dictate the fate of all of the content locked into the format, and the fortunes of the creators of that content.

Comments, too, are about helping people communicate. But it’s become clear that — more or less, depending on the particular site — few people who engage in comments on a blog are really all that interested in communication. If comments cease to be seen as communication and instead become an ugly, depressing wasteland at the bottom of web pages, then they’ll die off too.

Looking forward into a new decade, I am beginning to see the old alignments of the Internet as we’ve known it falling away. There’s a convergence of new standards, new devices, and new means of communicating. And this naturally means that certain older ways, “standards” or not, will fade from our day-to-day experience. I’ll certainly be happier to see Flash go than comments, but then again, I think I’ll do just fine either way. Let me know what you think. Or not.

The new site design, phase two

Lots to choose from...As I mentioned the other day, the initial launch of this new site design was just phase one — window dressing. Window dressing I happen to like a lot, but still… same old clunky underlying structure. But not anymore.

WordPress has a pretty rudimentary home page structure by default. Everything’s just *SPLAT* right out there on the home page. Sure, you can use the <!--more--> tag to trigger some automagic stuff with “Read more” links, but overall, it’s not too fancy. Which isn’t to say it’s bad. Now, the default page layouts for some other open source CMSes like Drupal or Joomla, on the other hand… yeah, they’re bad. (Or at least they were, the last time I bothered to care.)

So while WordPress out of the box doesn’t do much fancy stuff with the home page layout, it’s extensible enough that a crafty developer (or a well-read tinkerer) can do some pretty nifty stuff with it. And that was my goal with this new redesign: I’ve got hundreds of posts dating back over seven years now, and most are eternally buried in the archives. I’m hopeful this new approach will bring some of that older content to light, with the random articles list on the home page and the related articles list at the end of each article page.

I didn’t do it all alone… I had some help from a nifty article from Smashing Magazine: 10 Exceptional WordPress Hacks. In particular I made use of numbers 5 through 8 on this list… with some modification. Some of my changes were purely to suit my taste, but others were to improve the usability of the features and in at least one case to fix a bug in the provided sample code. It’s probably worth discussing the details here.

5. Display Related Posts Without A Plug-In

I set this up in single.php so it will appear at the end of each of my articles. I experimented a bit with matching both tags and categories, but I found (for reasons I didn’t dig deep enough to explain) that WP_Query() does well with either tags or categories, but not both.

And, most importantly, I found (or actually, SLP did) that this sample as given breaks comments on the page. Some commenters on the original post mentioned this problem too, along with its solution: you need to call wp_reset_query(); at the end, to tell WordPress to go back to working with the original post’s content.

I also modified the example to look at all of the tags associated with the post, not just the first (can’t really figure out why the original version did that), and tweaked the HTML/CSS output to suit my design. Here’s a simplified version of the code I’m running:

<?php
// Get related posts
$tags = wp_get_post_tags($post->ID);
if (!empty($tags)) {
  $tag_list = array();
  foreach ((array)$tags as $tag) {
    $tag_list[] = $tag->term_id;
  }
  $args = array(
    'tag__in' => (array)$tag_list,
    'post__not_in' => (array)$post->ID,
    'showposts' => 5,
    'caller_get_posts' => 1,
    'orderby' => 'date'
  );
  $related_posts = new WP_Query($args);
  if ($related_posts->have_posts()) {
    ?>
    <h2>Related Posts</h2>
    <ul>
      <?php
      while ($related_posts->have_posts()) {
        $related_posts->the_post();
        ?>
        <li>
          <a href="<?php the_permalink() ?>"
          rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
        </li>
        <?php
      }
      ?>
    </ul>
    <?php
  }
  wp_reset_query();
}
?>

My version also uses a special truncation function I wrote to display a short excerpt of each post, not shown here. (And yes, eventually I am going to get syntax highlighting set up.)

6. Automatically Retrieve The First Image From Posts On Your Home Page

This one worked pretty well. I changed the function name to something a little less quirky, and I also added some code to verify that the image actually exists, instead of just looking for an <img src> and assuming everything’s OK. This involved inserting the following block of code into the function immediately before if (empty($first_img)) {:

// Check that file exists
if (!empty($first_img)) {
  // remove http/ https/ ftp
  $src = preg_replace("/^((ht|f)tp(s|):\/\/)/i", "", $first_img);
  // remove domain name from the source url
  $host = $_SERVER["HTTP_HOST"];
  $src = str_replace($host, "", $src);
  $host = str_replace("www.", "", $host);
  $src = str_replace($host, "", $src);
  if (!file_exists(ABSPATH . $src)) {
    unset($first_img);
  }
}

If some of that code looks familiar, that’s because I copied it straight out of the next item. If I were writing it myself, or bothering to rewrite it, I would swap out that slightly cumbersome-looking three lines of str_replace() with a single preg_replace() — although perhaps the original coder knows something I don’t, like that doing it this way is actually faster. It very well could be; I know regular expressions are significantly slower than straight-up string replacements.

7. Resize Images On The Fly

I’m using this in conjunction with all of the other items here, no big surprise. I left it mostly as-is, although I did make one small change. I know well the dangers of scaling images up — they look like crap, basically. But a little scaling up doesn’t hurt. At least, it’s much less glaring than having a big set of uniform-looking images marred by one image that’s slightly smaller than the rest. That happened to me as I was putting this together, so I tweaked the script to allow images to be enlarged up to 1.5 times their original size. In timthumb.php I changed lines 103-109 to be:

// don't allow new width or height to be more than 50% greater than the original
if( $new_width > $width * 1.5 ) {
  $new_width = $width * 1.5;
}
if( $new_height > $height * 1.5 ) {
  $new_height = $height * 1.5;
}

8. Get Your Most Popular Posts Without A Plug-In

There was something about the way this one was written that really bothered me. Maybe it’s just that I have a knee-jerk reaction to seeing SQL code appear directly in a page template. But mostly it was that this didn’t match #5 closely enough. Luckily I discovered along the way that regardless of whether you retrieved post data using WP_Query (which returns an object) or with the $wpdb->get_results() method (which returns an array), you can use the same post functions once you’ve called setup_postdata(). So I kept everything from this example up through that, and then I used my modified version of the output code from #5 and it worked like a charm.

One other thing I’d recommend changing: it’s kind of silly to have the if ($commentcount != 0) conditional in there. Much better to just put WHERE comment_count > 0 in the SQL. I also added a date range to the SQL, to keep the list dynamic. In my case, it’s only looking at the most popular posts over a 3-month range. More active blogs could shorten that time frame. My full query looks like this:

$popular = $wpdb->get_results("SELECT * FROM " . $wpdb->posts .
" WHERE post_date > '" . date('Y-m-d',mktime(0,0,0,date('n')-3,date('j'),date('Y'))) .
"' AND comment_count > 0 ORDER BY comment_count DESC LIMIT 4");

There may have been some other changes I made that were relevant here but I think I covered all of the major ones. The tips on the Smashing Magazine site were invaluable in kick-starting my overhaul of the home page. It was uncanny that I stumbled upon this page today, just as I was getting down to this task anyway. It saved me a ton of time. But it still kept me on my toes, since all of the so-called “hacks” required some additional hacks of my own to get them working, or at least, to get them working the way I wanted!

What’s the point of blogging?

STFUNo, it’s not a rhetorical question. What is the point of blogging? If you’re a blogger, why do you do it (assuming you have a cogent reason)? If you’re a blog reader, why do you read the blogs that you do?

Here’s a secondhand quote on the matter that I found on one of the blogs I read:

In many ways the core of blogging is a willingness to apply what you know to every problem you encounter, and see how good a job you can do of it in a more or less integrated fashion.

That gem, which I had to read five or six times to understand, but the more I read it the more I agree, was written by Tyler Cohen on another blog I (less often) read.

Thinking about the blogs I read most, the authors have a clear purpose; the blogs have a clear theme. The authors are experts (or at least well-versed) in the subject matter they’re writing about, and the blogs become a commentary on the events of the day (within the author’s realm), bringing to the reader’s attention items of interest that they may have otherwise missed, and supplementing the link with a tidbit (or more) of relevant discussion.

So then, assuming that the success of a blog in achieving this goal is an end in itself, the point of blogging is to act as a niche news service with commentary, or perhaps more accurately as a trusted adviser — that “in-the-know” friend (though you probably don’t know the blog author personally) who knows what you’re interested in and keeps you on top of the latest and greatest.

It’s fascinating to think of the power blogs have in this way. But it also reinforces the importance of the trust I mentioned in the last paragraph. A blogger’s stock in trade is their trustworthiness. Readers need to know that the blogger actually knows what they’re talking about, and perhaps even more importantly, that they’re not being misleading — whether deliberately (for unknown nefarious purposes), accidentally (because they goofed), or due to the invisible hand of an outside influence (money from sponsors, potential to achieve a position of power and authority).

It’s easy to say that this is a reason not to trust blogs, and why blogs will always be — or at least are for now — inferior to “legitimate” journalism. But given numerous recent examples (all of which in my mind right now involve Glenn Beck in some capacity) of the failures of traditional media for many of these same reasons, I think blogging deserves more serious consideration.