Turning Wordpress into a tag-based blogging application
Summary: How to forego categories and date-based archives and turn your Wordpress-powered blog into a tag-based blogging system. Like del.icio.us, but a blog.
Like most bloggers, I don’t get a ton of front-page traffic. My visitor logs show that most of my visitors come via google, and land on a specific page. Given the behavior of my user base, I got thinking about how Wordpress is structured, and decided that the content I post on this blog isn’t optimized for my users.
First, understand that most blogs are sorted in time. The most recent articles appear on the front page, with the newest posts at the top. This makes perfect sense for blogs that are timely (newsblogs, for example) and are centered around a specific topic.
However, I’m not reporting news-type items, and this blog is not centered around a specific topic. I also update this rather inconsistently, sometimes going days without posting and sometimes posting many items a day. Really what I’m doing is creating individual pages first, and using the front page to organize the most recent posts instead of primarily publishing directly to the front page.
What I did this past weekend was modify my Wordpress installation so that posts could be tagged with keywords. This will enable users to navigate from one topic to another or stay within a given topic more easily.
Site Structure
First, I decided on the different pages I wanted within my site:
- Homepage - this would still have posts stacked in time
- Individual page - these would be the permalinks for each posts
- Tag archives - pages showing all posts tagged with one or more tags
- Tag cosmos page - a page listing all tags in the system
You’ll note that I have no monthly archives page. I think most vistors don’t find archives by date (e.g. monthly archives) very useful for browsing or locating content. How often do you only know when something was posted, and use that as the primary deciding factor when navigating within a site? Rarely, I bet. It’s just not useful information to anyone but the weblog author.
You’ll also note that there’s no category archives page. This is because the tag archives will function the same way as categories did, but are more flexible.
This site also has other special pages (search, recent comments, etc.) but those are outside the scope of this restructuring.
Key Ingredient: Ultimate Tag Warrior
Next, I installed the key to making this work: Ultimate Tag Warrior by Christine Davis. This is the Wordpress Plugin that makes this all possible.
UTW is cool because unlike Jerome’s Keywords (which I was previously using), UTW offers far more administration control over tags. It also automatically creates cool things like a tag cloud with very little work.
UTW also allows for the creation of links to related tags and related posts. These are incredibly useful for users who stumble on a page via google and want to keep browsing related content.
Lastly, UTW uses a neat Ajaxian engine in the admin section to allow for one click additions of tags (much like del.icio.us does when you post a bookmark).
Setting It All Up
Once I had UTW installed and activated, I went into my Wordpress themes and modified some of the tempates.
First, I wanted each individual page to have a sidebar noting that it was the permanent link and noting its tags. I also wanted each individual page to have links to related posts using UTW’s UTW_ShowRelatedPostsForCurrentPost function. This was accomplished using the is_single() function in Wordpress. Here’s an example of what I put in the sidebar template:
< ?php
if (is_single()){
echo "<p>This is the permanent link for the entry <strong>";
echo the_title();
echo "</strong>";
echo "<p>This post has been filed to ";
UTW_ShowTagsForCurrentPost("commalist");
echo ".</p>";
echo "<p>Related entries:<ul>";
UTW_ShowRelatedPostsForCurrentPost("posthtmllist");
echo "</ul></p>";
}
?>
You’ll note that I had to put a separate echo line for the paragraph marks. Not sure why, but Wordpress didn’t like HTML and the UTW function on one line, and was spitting out info in the wrong order.
Next, I wanted the home page to have a minimal sidebar with no reference to tags (since any regular visitors to the home page will likely be more interested in the timely organization of content than the categorized tagging of content):
< ?php
if (is_home()){?>
<p>Welcome to the home page.</p>
< ?php
} ?>
The tag archives and the tag cosmos pages were a bit tougher to create, and had to be developed outside of the Wordpress theme template structure. Since there was no is_tags() function for UTW pages, I had to create files on my server and have them use Wordpress data from outside the Wordpress install.
For the tag cosmos page, I simply used an include and a UTW function to create a big tag cloud page, sorted by popularity:
< ?php require('./wp-blog-header.php'); ?>
< ?php get_header(); ?>
<h3>Tag Cosmos</h3>
<p>< ?php UTW_ShowWeightedTagSet(sizedcoloredtagcloud);?></p>
< ?php get_footer(); ?>
Note that you could change the output of the tag cloud by changing the UTW function. A similar function that produces an alphabetical tag cloud is UTW_ShowWeightedTagSetAlphabetical(sizedcoloredtagcloud);.
UTW allows for a tag.php template to be used when a query is made on tags. So I created a new file named tag.php and put in in my templates folder. This file is to be used to create the tag archives page.
For the tag archives page I ran into the problem of not being able to include the Wordpress sidebar template (since there is no is_tags() function in Wordpress). I worked around that by hardcoding the sidebar functions on the tag archives page.
Final Outcome
What I ended up with a was a website that functions more like an internally hyperlinked set of posts and topics rather than a journal with archives by month. I think it’ll make for a better experience for visitors to this site, who can now browse by their topic of interest rather than through the order of posts.
To do
Ultimate Tag Warrior currently supports tag intersections in the URL, so someone looking for all posts tagged with both art and code could navigate to: http://trainque.com/index.php?tag=art+code and get filtered results. What I would like to do is modify UTW so that when it generates related tags it also generates a “+” symbol that allows you to further filter via combining tags. More on that later.
43 Comments
RSS feed for comments on this post.
[…] Mod WP Into a Tag Based Blog App: Like most bloggers, I don’t get a ton of front-page traffic. My visitor logs show that most of my visitors come via google, and land on a specific page. Given the behavior of my user base, I got thinking about how Wordpress is structured, and decided that the content I post on this blog isn’t optimized for my users. Interesting. Reminds me of Sam Ruby’s Blog. […]
Another combo I might recommend, which worked well for me is using the Cats2Tags plugin along with the Weighted Categories plugin. The former turns categories into tags and lets you create them on the fly very easily. The latter let’s you display a weighted “tag cloud” like del.icio.us or Flickr. I like Cats2Tags because I could create tags with spaces instead of dashes or underscores. So they are more likely to jibe with Technorati tags.
Terrance: I haven’t experimented with cat2tags, but I’ve heard good things about it. Ultimate Tag Warrior also lets you do space-separated multi-word tags, but you have to enter them in as underscore or dash separated.
I tried it and the underscored or dash separated tags show up in technorati with the dashes and the underscores in the tags. Most people don’t search technorati using underscores and dashes, so they probably wouldn’t find your tags. I understand, though, that WordPress does ping Technorati and Technorati picks up the categories as tags.
Yes, I think the creator of UTW already fixed the underscore/dash issue with vers. 2.6.2.
I quote:
[…] another tag mod for Wordpress. Read it at Turning Wordpress into a tag-based blogging application - JarrodTrainque […]
[…] […]
Nice post. You should create some mod_rewrite magic to allow urls like this: http://trainque.com/tag/art
Yeah, unfortunately my host (Yahoo) doesn’t like me to mess with .htaccess, so mod_rewrite is out of the question. (Unless you can think of another solution?).
My permanent links follow the next best option for Wordpress: passing the permalink through index.php, a la:
http://trainque.com/index.php/YYYY/MM/DD/name-of-post/[…] Wellicht doen: Turning Wordpress into a tag-based blogging application. [via] […]
Tag-basiertes Bloggen
Jarrod Trainque hat eine sehr interessante Anleitung geschrieben, um WordPress in ein Tag-basiertes Blogging-System zu verwandeln: Turning Wordpress into a tag-based blogging application
Ausgangspunkt ist die folgende Beobachtung:
Like most bloggers,…
[…] i mentioned in a previous post about having tags in wordpress. also mentioned in that post that i wanted it to be based on keywords as well, instead of just categories. well… i’ve found a site which has already done that and a plugin which allows me to do just that. […]
The template file is “tag.php” not “tags.php”.
[…] Turning Wordpress into a tag-based blogging application How to forego categories and date-based archives and turn your Wordpress-powered blog into a tag-based blogging system. Like del.icio.us, but a blog (tags: wordpress tips delicious) […]
[…] Turning Wordpress into a tag-based blogging application - Jarrod Trainque Filed under: WordPress by cordac | | Google It | […]
Unfortunately any tag system like UTW which uses a separate data structure and system for tags/categories negates a lot of existing WP functionality and makes it less forward compatible.
Matt: Agreed. Anyone taking this approach sacrifices forward compatibility, and should be comfortable working in code before hacking apart their blog.
I’d like to hear more specifics around the WP functionality that gets sacrificed through the use of UTW. Are you just talking about custom keywords, or more?
Also (since you are the person to ask): Has the Wordpress team put any thoughts or effort behind built-in tagging support for a future release? Specifically, I (and lots of other folks, I bet) would like to see the rather inflexible Category functionality replaced with something more tag-like.
assorted sweets: 2005.08.17
Turning Wordpress into a tag-based blogging applicationReally excellent. Had a chance recently to check out Wordpress and, despite my devotion to MT, was impressed. It’s what I’ll be recommending to new bloggers. Search for a job, look like you’re …
Site Update: Tag Based Blog
Welcome to the next incarnation of Theocrats.com. After reading a post about making Wordpress a tag-based application, I finally decided to use tags on Theocrats.com. I suppose I should give you a quick introduction to tagging before I try to convince …
[…] Welcome to the next incarnation of Theocrats.com. After reading a post about making Wordpress a tag-based application, I finally decided to use tags on Theocrats.com. I suppose I should give you a quick introduction to tagging before I try to convince you why tagging is such a nice addition to Theocrats.com. […]
[…] Turning Wordpress into a tag-based blogging application Summary: How to forego categories and date-based archives and turn your Wordpress-powered blog into a tag-based blogging system. Like del.icio.us, but a blog. […]
[…] daily bookmarks that I’ve added to del.icio.us into WordPress" // posted by t.a.l. @ 11:53 PM Comments: Post a Comment <<Home […]
[…] Jarrod Trainque has turned his blog into a tag based system. […]
[…] The plugin I used to add tag support to WordPress is Ultimate Tag Warrior. This description of the process was a big help, too. […]
My blog’s been using tags since I moved to Wordpress. It uses Jerome’s keywords, but doesn’t have all the features of what you’ve implemented.
[…] Nu wordt er gezaagd aan andere poten van weblogs: de chronologische volgorde en de indeling in rubrieken. Neem maar eens een kijkje bij Jarrod Trainque: First, understand that most blogs are sorted in time. The most recent articles appear on the front page, with the newest posts at the top. This makes perfect sense for blogs that are timely (newsblogs, for example) and are centered around a specific topic. However, I’m not reporting news-type items, and this blog is not centered around a specific topic. I also update this rather inconsistently, sometimes going days without posting and sometimes posting many items a day. Really what I’m doing is creating individual pages first, and using the front page to organize the most recent posts instead of primarily publishing directly to the front page. […]
[…] Turning WordPress into a tag-based blogging application […]
[…] Turning Wordpress into a tag-based blogging application […]
[…] Turning Wordpress into a tag-based blogging application - Jarrod Trainque Tagged as: applications blog blogging delicious design development guide hack howto php pluging plugins rss tools wordpress […]
Did you ever get an answer from Matt or discover what he meant by UTW causing problems or a loss of functions in WordPress?
Jarrod, could you please post the sidebar code you used in tag.php? I’ve tried doing just this with UTW but I’m having some php errors. THX!
Andres: this is what I have to generate the sidebar used on my site:
Note that this is hard-coded into the tag.php file,not included via the sidebar template. I ran into a problem getting the sidebar logic to recognize when you are viewing a tag archive, hence the hard-coding. For some reason it was treating it like an an individual page,not a tag archive.
Also, I’ve been hacking around in UTW quite a bit, so your output may or may not look exactly the same as mine, especially if I messed with some UTW functions. Good luck.
THANKS! I also just realized that I hadn’t activated 1.3 Legacy of UTW so ultimateshowrelatedtags hadn’t been defined. The lack of an istags()function is algo going to require some hardcoding to show the headers properly. I think this will be addressed in a future rev of UTW. Great stuff though!
U must have made some slobby coding, your tags-page takes over
5 secs. to generate, thats just too slow for me. Otherwise nice
features!
Niels:I too have noticed pageloads taking quite a long time… I’m not sure why, exactly, but it’s something I’m looking at.
I did modify the UTW code to have a higher display limit (999 tags), which might be causing the problem. I’ll monkey around with it and let you know if that’s the issue.
[…] I found some hints about how to change the templates in Jarrod Trainque’s blog. I show the “related posts” when a single post is selected : (in post template) <?php if (issingle()){ echo “<p><small>Related posts :<ul>”; UTWShowRelatedPostsForCurrentPost(”posthtmllist”); echo “</ul></small></p>”; } ?> Note : to change the templates : go to Presentation / Theme Editor. Depending on your template, you may choose different presentations. […]
Update: I was able to figure out why performance was so slow (~10 seconds per page load). Turns out it had nothing to do with UTW, but rather another Wordpress Plugin called Bad Behavior that was logging thousands of spam requests into the Wordpress database.
[…] Turning Wordpress into a tag-based blogging application - Jarrod Trainque Technorati Tags: foo [link] […]
I dunno, this seems very confusing and i am sure many others can agree.
Perhaps WORDPRESS will incorporate some of these useful mods by default next time to take the edge off of having to spend so much time just to fine tune matters like most expect.
Also some word of note: Seems even the authors of these plug ins are confused themselves occasionally and is why i feel a complete EXAMPLE template SHOULD BE included with every release.
I know i personally find it more rewarding and am faster to compliment these efforts when there is something to work from already made available instead of having to hack to death this and that in the code and go thru all that considerable time consuming work.
[…] Turning Wordpress into a tag-based blogging application - Jarrod Trainque Technorati Tags: wordpress […]
[…] http://m.iscellaneo.us/2005/08/15/turning-wordpress-into-a-tag-based-blogging-application/ […]
[…] For a great post which discusses category vs. tag based blogs, read Turning Wordpress into a tag-based blogging application. […]
[…] Add tags to your blog. You can forego categories and date-based archives and turn your Wordpress-powered blog into a tag-based blogging system. “Like del.icio.us, but a blog.” Go to Jarrod Trainque’s weblog to learn just how to do this. (What is a tag? Read this New York Times article about tags and folksonomy.) […]