What Every Blogger Needs to Know About Categories

sexy nurse illustration

Because of the way they are misused all over the Web, categories have grown to become something that we regard in a purely user-centric light. We think of them as navigational tools and guides for users, but in reality, categories are a powerful tool that bloggers can use to exercise precise control over content in a dynamic environment.

Unfortunately, the true power of categorized content has been masked by the one size fits all implementation you see everywhere on the Web—the proverbial long, ugly list of category links now appearing on a blog near you.

As luck would have it, that awful category list also turns out to be a very poor presentational strategy for your site…but why?

Why Your Category List Isn’t Doing You Any Favors

By giving users a list of categories to browse on your site, you are creating a psychological conundrum that usually leaves them with a severe case of analysis paralysis. This is a condition where users, when presented with too many options, end up selecting nothing at all.

Being presented with more choices, even good ones, can hinder effective action. In one study, doctors couldn’t make a decision when a second promising drug showed up.

Fast Company, November 2007

Counter-intuitive? Maybe. Human nature? Absolutely.

Whether you’re selling products, writing copy, or designing interfaces, you can benefit from playing into basic human psychology. And interestingly, with Website categories, accommodating natural human behavior also turns out to be an excellent SEO strategy!

Automated SEO and Content Management with Categories

At first glance, it seems convenient that WordPress automatically creates category pages, tag pages, and just about every other type of page you can imagine1. Dig a little deeper, though, and you’ll find that this form of page bloat is a remarkably poor site-building practice—it’s a condition that should be avoided whenever possible.

As far as blogs are concerned, categories are the single biggest contributor to both page bloat and link dilution, two of the most abominable SEO sins. Ironically, when used properly, these same categories hold the key to efficient, automated site optimization and content management…

The difference, of course, is all in how you use them. Armed with a bit of knowledge and a few lines of code, you’ll be able to use categories to:

  • display content however you like, wherever you like
  • link directly to interior pages—not to interstitial “bloat” pages like monthly archives or category archives
  • provide your users with a smarter, more intuitive way to browse content that may be of interest to them

WordPress Example: “Popular” Articles

Turn your attention to the sidebar of this site, where you’ll find lists of posts underneath subheadings like “Must Reads,” “Improve Your Blog,” and “Worth a Look.” As you might have guessed, I use categories to control the content of each list, and now we’re going to examine how you can do the same. For the sake of this example, let’s focus on the “Must Reads,” which are controlled by the “Popular” category.

The first step is to categorize each applicable post in an identical and meaningful way—in this case, “Popular.” Keep in mind that it makes no difference how many posts you lump under one category, simply because you’ll establish all display control through your code (which you are about to write).

Once you’ve categorized your articles, the second step is to determine what you want to display and where you want to display it. In this example, the goal is to display a list of popular posts over in the sidebar, so in order to do that, you should open the sidebar.php template file for editing.

Now that you’ve opened the appropriate theme file, it’s time to move on to the third step, which is the coding portion of our show. Here’s the code I used in sidebar.php to generate a list (<ul>, <li>) of popular articles: 2

<?php
   query_posts('category_name=Popular&showposts=5');
   while (have_posts()) :
      the_post();
?>
   <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?> <?php comments_number('0', '1', '%'); ?></a></li> 
<?php
   endwhile; 
?>

Take a look at the following snippet from the above code:

query_posts('category_name=Popular&showposts=5');

This line tells WordPress to look through its database and fetch the 5 most recent posts from the “Popular” category. Once you’ve acquired the appropriate posts, all you need to do is loop through them, displaying only the information you want. Here’s the code from our example:

<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?> <?php comments_number('0', '1', '%'); ?></a></li>

In this case, I chose to display direct links to the posts, and I also embellished a bit to include the number of comments on each. The most important thing to take away from this is the fact that I could have displayed any piece of information associated with the resulting posts—I just tailored the output to my exact needs.

The Bottom Line

Categories are like a site’s DNA—they literally form the organizational framework that houses all of a site’s information. Like DNA, category structures are unique, and therefore, a one size fits all solution for handling them doesn’t make any sense.

The good news, however, is that you can help your users, improve your SEO, and gain absolute control over your content by implementing your own WordPress category solution!

1 Other CMS platforms do this as well, but for this article, I chose to focus primarily on WordPress.

2 For the sake of brevity, I have chosen to show only the code that loops through the individual list elements (<li>).

Did you know?

I make software you can use to run a blazing-fast website (like this one).

Check out the Focus WordPress Theme to see how you can run a fast website that delights your visitors, ranks like crazy, and is easy to manage.