Macros on this site

Examples of these macros in use are in this entry.

photo macros

Summmary: you supply the name of the image (e.g. "foo.jpg"), and it spits out the full HTML for displaying that image (e.g. <img src="path to photos/foo.jpg" width="320" height="240" alt="photo" />).



Macro Code:

<MTMacroDefine name="photo" ctag="photo"><img src="<MTMacroContent>" width="320" height="240" alt="photo" /></MTMacroDefine>

Detailed Description:
I take a lot of photos, and occassionally I'll post a set of them onto my blog. This macro is useful when you're posting a small number of photos to your blog. If you're posting a photo album, there's other plugins that are better for this (in my case, I just use Adobe Photoshop Album).

This plugin has multiple uses, all of which have saved me a lot of time:

(1) if I move my photos I only have to edit the macro to repair all the links. I used to store my photos on my ISP's Web server in order to conserve bandwidth to When I switched providers, I no longer had this option, so I had to move all the images back onto my own server. With the photo tag this only takes a minute or two, as you just have to edit the macro to change the URL.

(2) on the archives pages I can change the image to a link in order to conserve bandwidth. I have a 'photos' archive page that contains summaries of all the photo entries that I've posted to the blog. Without the macro, someone loading the page would download every photo I've posted onto my site. Instead, I just use a 'low-bandwidth' version of the macro to replace the image with a link instead. This is the macro I used for my "category archives' template:

<MTMacroDefine name="photo" ctag="photo"><em><a href="<MTMacroContent>" title="Photo link">this entry contains a photo, click to view</a></em></MTMacroDefine>

(3) it saves a whole lot of typing and automatically includes the correct img width/height tags. All of my images are either 320x240 or 240x320, so it doesn't make sense to type all that out every single time. I simply have two photos tags, one for 320x240 photos, and one for 240x320 photos, and I use them accordingly.

imdb macros

Summary: takes in the name of a movie and turns it into a link to search IMDB for that title/actor/etc...


<imdb>Finding Nemo</imdb>

Macro Code:

<MTMacroDefine name="imdb" ctag="imdb"><a title="IMDB: <MTMacroContent>"

Detailed Description:
I wanted an easy way to link to IMDB movies without having to go to IMDB, search for the title, find the movie, copy the link, paste the link into the entry, etc... This method isn't perfect, but it's close enough as it will either take the user to the appropriate movie/actor page, or show a search results page that contains the correct page in it.

amazon macro

Summary: Takes in the asin of an Amazon product and spits out a picture of the product and a link to the Amazon page.


<amazon isbn="xxxxx">Snow Crash</amazon>

Macro Code:

<MTMacroDefine name="amazon" ctag="amazon"><MTIfNotEmpty expr="[MTMacroAttr name='isbn']"><MTAmazon devtoken="D241B69FTX23J5"
associateid="bradchoate" search="[MTMacroAttr name='isbn']" method="Asin"><a href="<MTAmazonLink>" title="Amazon: <MTAmazonTitle>" ><em><MTMacroContent></em></a></MTAmazon></MTIfNotEmpty></MTMacroDefine>

Detailed Description:
I don't use this macro very much anymore, mainly because I've discovered a more elegant way to include Amazon information that uses MTAmazon + KeyValues. You can read about this alternate method in this entry.

Created:January 31, 2004