Howto: Use MT Tags in TypePad!
August 7, 2003
My first post of many about how to integrate some MovableType tags in to your TypePad and MovableType blogs!
Today the issue is using <$MTEntryAuthor$> to recognise posts on multi author blogs as icons or images rather than just 'Posted by Ben' as posed by Joel Blain on the Typepad Beta Yahoo group.
First of all, all tags I use can be referenced from MovableType's template tag page and although they are for MovableType, most, if not all, work on TypePad.
Template tags, and templates in general, can be a very simple or a very complex part of your blog. Either way, they allow you to post once and have your most recent *insert_number_here* posts show up on your blog as well as many other important functions.
There are three main sections of your blog in your template (normally). The first is everything up to the <MTEntries> tag, the second is everything from there to the end of the same tag (</MTEntries>) and the third is everything after that. The first and third sections are pretty regular tag sections and I'll get in to them later. The one we're interested right now is the second one.
I'm about ready to break out the sample code.
[code]
<MTEntries>
<$MTEntryTrackbackData$>
<MTWeblogPostIfShow field="date_header">
<MTDateHeader>
<h2><$MTEntryDate format_weblog_date="1"$></h2>
</MTDateHeader>
</MTWeblogPostIfShow>
<a id="a<$MTEntryID pad="1"$>"></a>
<MTWeblogPostIfShow field="post_title">
<h3><$MTEntryTitle$></h3>
</MTWeblogPostIfShow>
<$MTEntryBody$>
<MTEntryIfExtended>
<p class="extended"><a href="<$MTEntryPermalink$>#more">Continue reading "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended>
<p class="posted">
<$MTEntryDate format="%B %e, %Y"$> at <$MTEntryDate format="%I:%M %p"$> | <a href="<$MTEntryPermalink$>">Permalink</a>
<MTEntryIfAllowComments>
| <a href="<$MTEntryPermalink$>#comments">Comments (<$MTEntryCommentCount$>)</a>
</MTEntryIfAllowComments>
<MTEntryIfAllowPings>
| <a href="<$MTEntryPermalink$>#trackback">TrackBack (<$MTEntryTrackbackCount$>)</a>
</MTEntryIfAllowPings>
</p>
</MTEntries>
[/code]
This is the <MTEntries> section of my index. Unlike the other sections certain tags used within this section are POST SPECIFIC. This means that if I was on a community blog and I posted, <$MTEntryAuthor$> would be 'authgeek' within my post. This can be a confusing topic to some people but as long as you realize that each post is reusing this second section of your blog and grabbing information from the author every time a new post is posted, you should be fine.
Now, adding author-based images.
Since <$MTEntryAuthor$> and <$MTEntryAuthorNickname$> are specific to every post, we can create a directory of images, say pictures/, and place images that are named like the author or nickname in that folder. So I'd create a folder with authgeek.jpg, joelblain.jpg and bentrott.jpg in it. Then, using the second part of our template (between <MTEntries>) we can place an image using conventional html (<img src="http://authgeek.typepad.com/communityblog/pictures/ authgeek.jpg">) and add a tag to make it post-specific (<img src="http://authgeek.typepad.com/communityblog/pictures/ <$MTEntryAuthor$>.jpg">). This way, any post from Ben would fetch the image bentrott.jpg and any post from Joel would fetch the joelblain.jpg image.
That's just about how it goes. If you have any questions, I'd be more than happy to answer them in the comments or through email. I'll have to write another one of these soon... it was fun!
Note: I added a few spaces in my code so that it all fit on my mediocre-width blog. Be sure to doublecheck html before you cut and paste anything.
-edit- Be sure that you DOUBLE CHECK your author name (taken from your first name plus a space and your last name) and your nickname (just your nickname) as they are specified in your profile. You MUST name your images after these values or else you'll be requesting the wrong name. Always check your source for potential mis-requests if you run in to problems.