Categories & Tags Mayhem (∴ SQL)


I was just about to write on a few things I’m reading – Michel Serres, Black Metal Theory mostly – and suddenly felt an urge to clean up, merge, rename, delete some of the 1300 tags on supernaut, when I noticed something dead weird: some of the tags were simultaneously categories. Much messing around and the inability to edit or change taxonomies caused me to have a look at the database, where I found, horribly, they indeed existed as both. I guess this is either a hangover from the Movable Type port some years ago, or a plugin that didn’t do its job properly around the same time. So I manually deleting 50 or so of these and their relationships. And then did some more merging and renaming. And now I must eat.

technorati tags and blog aggregators

(Geek warning, coding follows) T-Salon had a post on Technorati and their new blog aggregators, which are based around tags and include Flickr photos and links. Currently it’s not a particularly representative aggregator, as it just scrapes any blog on Technorati via the category for each entry. As most China blogs – or any that are on a specific topic don’t need to explicitly state that topic in every post, it tends to collect generalist blogs who have made a specific post about the topic or tag.

It is however, capable of supporting keywords as tags, and this is where it becomes both powerful and much more specific. Keywords are just that, they list the most relevant words from an entry, and provide a much more precise description of the entry subject and content. Also they are dynamic and are drawn from the entry itseld, unlike categories which are fixed and to which an entry is assigned.

Using the keywords to build the tags can all be done dynamically, as John’s Jottings shows in Movable Type. It’s a fairly straightforward process using Ben Hammersley’s keyword code and Brad Choate’s PerlScript Plugin.

ecto the blog client already supports keywords in an entry, and it probably won’t be long until some kind of keyword tag function is incorporated into it.


I’ve spent about an hour installing the plug-in and getting it working, along with the MTKeywords plugin, which automatically fills the keywords metatag in individual posts’ head tags with keywords parsed from the entry, it doesn’t support non-western languages though, so I might have to get dirty. All pretty easy. I made some changes to the code from John’s Jottings though, preferring to split keywords on commas instead of spaces. This allows for people’s full names to be one tag rather than splitting into first and last names, which is fairly meaningless. I also used Ben Hammersleys’ if-else condition to hide the keywords if an entry doesn’t have any, coz I don’t have time to go back through 350 or so entries and keyword them right now. Overall pretty bloody simple. Code here for anyone who wants to see.

my $keywords = “<$MTEntryKeywords$>”;

if ($keywords eq “”) {

print “<!– No Technorati Tags to print out //–>”;

} else {

my @split_keywords = split(/,/, $keywords);
my $split_keyword;
print ‘<br/><a href=”” title=”technorati”>Keywords:</a> ‘;
foreach $split_keyword (@split_keywords) {
print ‘ – <a href=”’.$split_keyword.'” rel=”tag”>’.$split_keyword.'</a> ‘;


[edit] While I was redesigning my site, I reworked this because the layout was dependant on there being something in the Keyword line, and the “<!– No Technorati Tags to print out //–>” left that line blank. I’m not a perl scripter, so maybe this is common knowledge, but having “”, double speech marks around this line containing real text causes the search function in Movable Type to fail

print “<!– No Technorati Tags to print out //–>”;

The solution is to use single quotes to contain any text or html:

print ‘No Technorati Tags available’;