Blogs just aren’t the same as they used to be. In the old days a blog was characterized by time and personality—chronology was important, and you read the blog because of the author, not the information he could give you.
Nowadays blogs are used more for short bursts of information about a single topic—typically a blogger’s expertise. The personality behind a site barely matters. “Content is king!” as you may recall.
So if chronology is no longer important, why post by date? I think part of the answer is that WordPress displays dates by default in most themes. Let me propose an alternative way of displaying content in WordPress. By tag frequency.
Making tags useful
Tags provide wonderful meta information about a post, but sadly this information is typically relegated to an ugly list in the sidebar. I say, if you’re going to go to the work of tagging all those posts, you had better use those tags for something useful!
By adding a couple snippets outside “The Loop” in WordPress you can display N number of posts by X tag. Here is an example to help make it a little more clear:
Imagine you have 20 posts tagged Home and Garden, 10 tagged Clearance, and 13 tagged Hardware. With a bit of PHP we can get WordPress to display posts from each tag in order of most popular to least popular. We can even take it a step further and limit the number of tags to display. The end result might look something like this:
HOME AND GARDEN * Tag 1 Post 1 Title * Tag 1 Post 2 Title * Tag 1 Post 3 Title * Tag 1 Post 4 Title HARDWARE * Tag 2 Post 1 Title * Tag 2 Post 2 Title * Tag 2 Post 3 Title * Tag 2 Post 4 Title CLEARANCE * Tag 3 Post 1 Title * Tag 3 Post 2 Title * Tag 3 Post 3 Title * Tag 3 Post 4 Title
Now that is a usable list of tags that makes the content readily available. A great side effect of displaying posts by tag frequency is that your site become much more dynamic. For example, maybe you go to a plumbing conference and blog 30 posts about it, all tagged Plumbing. The content on the site will automatically start displaying the posts tagged with Plumbing at the top of the list. I call it the “bubbling” homepage.
Enough rambling, here’s the code:
have_posts() ) :?>
- name ?>
With the emerging of tags, and I’m not talking about Technorati tags here but tags as a part of your own blog, categories can become redundant. A lot of blogs out there has got a bunch of categories, and with the addition of tags, they suddenly have duplicates of everything. Or perhaps they have a lot of categories, because the categories have been used as tags, basically, which perhaps was a great idea back then, but today is totally unnecessary.
Finding a balance between categories and tags might not be as easy, nor as obvious, as one would like to think.
The Ideal Category/Tag Setup
In my opinion, categories and tags are two completely different things. Mind you, I’m tackling this issue as both a designer and a publisher. The ideal setup for your particular fancy or site might be something completely different, there’s the whole matter of what you need and want as well, of course.
I define categories and tags like this:
- Categories are main sections of the site. If you’ve got an entertainment blog, “music” might be one category, and “movies” another, but no more niched than that.
- Tags are descriptions of post content. This means that if you’ve got a post in that “music” category, it might be tagged “metal” because that’s the genre, and “Alice Cooper” because that’s the artist.
The benefits of this way to look at categories and tags, is that categories can be treated as true sections of your site. Most blogging platforms support category specific styling, so that music category can have a cool guitar at top, or use a special color, or whatever. The point is that you can style a specific category in a fitting way, making it more obvious that it is one of the (few) main sections of your blog.
It might take some time to apply a more sound use of categories on your blog, but defining your sections is a good thing.
Tags, on the other hand, are like a loose search query. The point isn’t to style everything tagged “Alice Cooper” in a specific way, since it might be posts from completely diverse areas (i.e. different categories), but rather to list everything relevant.
The Blog Herald had a gadzillion tags before its redesign. Since it uses WordPress, I used the included script to convert categories to tags, and then sorted the content in more relevant categories, like news and features, and so on. It might take some time to apply a more sound use of categories on your blog, but defining your sections is a good thing.
If you’re using a blog platform as a CMS (something I’ve touched before), using categories as main sections of your site makes even more sense. After all, you’ve got your menu right there, in the categories, and you’ll be using the blog platform as it is meant to be used, the only difference is that you’ll style the various categories a bit more elaborately than you might have for a traditional blog.
What are your thoughts on how to use categories and tags on a blog? Share your thoughts in the comments!
If you’re a good Web 2.0 person, you’ve probably been relentlessly tagging all your entries. You might even have a tag cloud so big it threatens to rain folksonomies. But shouldn’t there be something more useful you can do with your tags? How about linking to related entries? Here’s how we can do it in Movable Type, and without installing any extra plugins.
First, create a new Template Module named “Related” and type this code into the box:
<mt:setvarblock name="curentry"><mt:entryid /></mt:setvarblock>
<mt:setvarblock name="sgtags"><mt:entrytags glue=" OR "><mt:tagname></mt:entrytags></mt:setvarblock>
<mt:setvarblock name="listitems"><mt:entries tags="$sgtags"><mt:setvarblock name="listentry"><mt:entryid /></mt:setvarblock><mt:unless name="listentry" eq="$curentry"><li><a href="<mt:entrypermalink />"><mt:entrytitle /></a></li></mt:unless></mt:entries></mt:setvarblock>
It’s very important that when you type this in there are no line breaks within any of the
<mt:setvarblock></mt:setvarblock>containers. In theory, you should be able to use the
strip_linefeedsattribute and not worry about line breaks, but I’ve not had any luck with that. In fact, it’s revealed a very strange bug. Rather than deal with bugs, we’ll just remove the line breaks ourselves.
Now save it and go to your Entry Archive template. Somewhere in there (if you’re using the default templates, right after
<$MTInclude module="Entry Detail"$>would be a good choice) add this line:
Republish your blog and you should see a list of related entries on each individual entry page. Let’s take a closer look at our code and see what’s happening.
We don’t want to do any of this if the entry doesn’t have tags.
<mt:setvarblock name="curentry"><mt:entryid /></mt:setvarblock>
We store the ID of the current entry to use later.
<mt:setvarblock name="relatedtags"><mt:entrytags glue=" OR "><mt:tagname></mt:entrytags></mt:setvarblock>
Here, we’re using the
<mt:entrytags>container to output a list of tags from the current entry. The
glueattribute specifies what text should be between multiple tags. So, if our entry is tagged with cats, pet food, and dogs, we’ll get this:
cats OR pet food OR dogs
And this will be stored in a variable we’ll use on the next line.
<mt:setvarblock name="listitems"><mt:entries tags="$relatedtags"><mt:setvarblock name="listentry"><mt:entryid /></mt:setvarblock><mt:unless name="listentry" eq="$curentry"><li><a href="<mt:entrypermalink />"><mt:entrytitle /></a></li></mt:unless></mt:entries></mt:setvarblock>
We’re using a
<mt:entries>container with the
tagsfilter. This will limit the entries returned to only those that have at least one of the tags from the current entry. As we process each entry, we store its ID in a variable. We then use the
<mt:unless>conditional tag to compare the ID to the one we stored earlier. This allows us to filter out the current entry from the list we’re creating. If it’s different from the current entry we create a link to that entry and store it in a variable to use in the final output (which is only output if there is anything in that variable):
Now, this is not necessarily the best way to do related entries. There’s no “scoring” involved to determine which entries are the most related, we just assume they’re related if they have at least one tag in common. And if you’re publishing static files rather than publishing dynamically then old entries won’t have links to new entries unless you republish your entire blog. Still, it’s an easy way to link your entries, and it’s a good example of the complex things you can do with Movable Type variables.
have_posts() ) : $postsRight->the_post(); ?>