I wrote my original post about running two blogs on one site a while back, and it’s been one of the most popular articles here, but I’ve never been entirely satisfied with the approach. Maintaining two separate WordPress blogs, even when they share the same installation files, is not really convenient.
So when I revamped the site recently I was keen to find an alternative way of handling the issue. In this article I’m going to describe how I set about it.
One of the newer features of WordPres is the ability to have both categories and tags. The distinction between the two is largely a form of words, but having both is very useful. For example categories can be used to distinguish between different types of article, while tags can be used to identify their subject matter. In my case I decided I’d have just two categories, one for my Portfolio and one for this blog.
The first thing I needed to do was to merge the two existing separate blogs. That was quite straightforward. I used the WordPress import/export feature to export the portfolio blog then import it into the database of my main site. I added a new category “Portfolio” and manually applied it to all the new entries; similarly I set another new category “Technology Blog” and applied it to all the other posts.
I then set about organising my tags. Another recent feature is the Categories to Tags converter, also to be found on the Import page. I used that to convert all the other post categories I wanted to continue to use, before deleting any that didn’t fit with the new scheme.
Next I installed the Category Page plugin so I could more easily give the two categories their own identities, and edited my .htaccess file to redirect from the old URLs for the portfolio and blog to the new ones, with rules like these:
RewriteRule ^journal /category/technology-blog/ [L,R=301]
RewriteRule ^portfolio/?$ /category/portfolio [L,R=301]
RewriteRule ^portfolio/(.$) /$1 [L,R=301]
Finally there was one last problem to be solved, which was to make it possible to show subsets of each category by tags, so I could link to, for example, all my Drupal portfolio. Despite the fact that the code for queries like this is in the core, as covered well in a useful blog entry on taxonomy intersections by Ryan Boren, there isn’t a standard way to do this.
I ended up writing my own little plugin to handle such queries, but I note from the comments there is another one that does the same thing along with some other functionality: TDO tag fixes. I’ll probably install that the next time I update the site. I’d be interested to see how it’s done, as the method I’m using for now is a little ugly.
In summary, I still feel there’s some way to go: WordPress certainly does not make this particular task easy. Given it’s the sort of thing that would be effortless with Drupal, it’s a little frustrating having to spend so much time on it.