kwc.org Photos Spare Cycles MythBusters

Update to books category

The kMMS taught me some cool tricks that will save me some time in the future when I write book entries. I thought I'd post it here because I have witnessed other movable-typers struggling with the same issue, and this might save them a bit of time.

One of the things that can be time consuming when you write a book entry is including an image of the book. You either have to go to Amazon, search for the book, and copy the entry, or you use MTAmazon to generate the HTML and then copy it into the entry. Most recently I had been using MTAmazon + Macros

to add in an <amazon> tag that would do the image, but it was kinda klunky.

My latest method is a lot easier, and now uses MTAmazon + MT Plugin Directory: KeyValues. All I do is place the following text in the 'keywords' field:

asin=xxxxxxx

which only requires me to look up the asin of the book, which I do anyway in order to maintain my reading list.

There are numerous advantages to this method: * it requires a minimal amount of text to be added to the book entry * it overlaps well with other activities (updating reading-list) * it allows me to customize the image that is displayed, so that on the main page I can use a medium-sized image, on category archives I can use a small image, and in the actual entry I can use a large image. I can even do what I did in the kMMS and include publisher info, price, Amazon rating, etc... in the actual entry. I haven't really explored all these options, but I may when I have more time. * I can modify all of the book entries in the future quite easily without having to edit individual entries.

Here is the code I added to the Individual Entry Archive

<MTKeyValues source="[MTEntryKeywords]"> <MTIfKeyExists key="asin"><MTAmazon devtoken="D241B69FTX23J5" associateid="bradchoate" search="[MTKeyValue key='asin']" method="Asin"><a href="<MTAmazonLink>"><img align="right" src="<MTAmazonMediumImage>" alt="Amazon Image" border="0" hspace="5" /></a></MTAmazon></MTIfKeyExists></MTKeyValues>

<MTMacroApply><$MTEntryBody$></MTMacroApply>

<a name="more"></a> <MTMacroApply><$MTEntryMore$></MTMacroApply><br clear="all" />

Explanation: * <MTIfKeyExists key="asin"> checks for the 'asin' key in the keywords field. If its there, it's value is passed to the MTAmazon search. * The <MTMacroApply> tag takes care of some other macros I have running the site. * The <br clear="all" /> tag is important because I right-align the images. If the entry happens to be short, then the image of the book will encroach on other entries. The br tag makes sure that the entry extends to the bottom of the image.

I am deeply indebted to Brad Choate, who wrote the wonderful Macros and KeyValues plugins that I have abused on this site.

TrackBack

Listed below are links to weblogs that reference Update to books category:

» http://www.thadman.com/sidelinks/archives/week_2004_01_11.html#001580 from digressions
kwc blog: Update to books category | Absolutely excellent tutorial detailing how to add MTAmazon info to individual MT entries.... [Read More]

related entries.

what is this?

This page contains a single entry from kwc blog posted on November 13, 2003 7:08 PM.

The previous post was Getting closer to wireless power.

The next post is Cool Inventions of 2003.

Current entries can be found on the main page.