Learning Movable Type: Adding a "Posted to Category" Line


mtbadge-small.gif The default settings for Movable Type include category archiving. If you assign categories to your posts, you may want to include that information in the "Posted by" section underneath each entry. This is quite easy to do.

In the Main Index template, find the following block of code:

<p class="entry-footer">
<span class="post-footers">Posted by <$MTEntryAuthorDisplayName$> at <$MTEntryDate format="%"$></span> <span class="separator">|</span> <a class="permalink" href="<$MTEntryPermalink$>">Permalink</a> <MTIfCommentsActive>| <a href="<$MTEntryPermalink$>#comments">Comments (<$MTEntryCommentCount$>)</a></MTIfCommentsActive> <MTIfPingsActive>| <a href="<$MTEntryPermalink$>#trackback">TrackBacks (<$MTEntryTrackbackCount$>)</a></MTIfPingsActive>
</p>

Add the following code before the closing closing p tag of the code above.

Posted to <MTEntryCategories glue=" | ">
<a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$>

Save and rebuild your Main Index template.

In your Individual Entry Archive Template, find the following code:

<p class="entry-footer">
<span class="post-footers">Posted by <$MTEntryAuthorDisplayName$> on <$MTEntryDate$></span> <span class="separator">|</span> <a class="permalink" href="<$MTEntryPermalink$>">Permalink</a>
</p>

Add the following code before the closing span tag or p tag of the code above.

Posted to <MTEntryCategories glue=" | ">
<a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$>
</a></MTEntryCategories>

Save template and rebuild your files.


Posted by Elise Bauer on January 14, 2006 6:42 PM to Learning Movable Type http://www.learningmovabletype.com/