« I Flickr, You Flickr, We All Should Flickr | Main | Trim the Apple Tree »

HOWTO: Add Flickr Tags with Movable Type Keywords

This HOWTO is incredibly similar to the docs for the KeyWordList plugin itself. I only add how to incorporate the MTIfEmpty plugin so you don't have to worry about blank output when you haven't entered any keywords on some of your posts.

First you need some MT plugins.

Now you need to modify the template where you want the tags to appear. It needs to be inside an <MTEntries> block.

<MTIfNotEmpty expr="[MTKeyWordList]1[/MTKeyWordList]">
Flickr tags: 
<MTKeyWordList>
<a href="http://flickr.com/photos/tags/<$MTKeyWord$>" rel="tag"><$MTKeyWord$></a> 
</MTKeyWordList>
</MTIfNotEmpty>

The MTIfNotEmpty is used to check for the existence of one or more keywords. If you don't have any keywords, you probably don't want to have any output (a dangling 'Flickr tags:' in my case). MTKeyWordList will then loop over all your keywords for that post and, in this case, make links to Flickr tags. You can obviously make links to other services (Technorati, del.icio.us, etc...) and you can do anything you want HTML-wise. I'm sure all the semantic web weenies would be screaming about how I'm not using a list for what clearly is a list. That is, if anyone read this of course.

I'm using this in MT 3.15 and I've used similar hacks in MT 2.5x - 2.6x. So you should be good to go.

This weblog is licensed under a Creative Commons License and powered by Movable Type.