Templating Tricks: Movable Type to Rich Text

A few years ago Six Apart's Anil Dash posted this article about using Movable Type to generate a Word document of your blog or part of it. It uses WordML to generate a Microsoft Word 2003 formatted documents. This is fine and dandy if you have Word, but what if you don't?

As Anil's post shows, it is very easy for Movable Type to generate any document type that you know the specification, so lets give it a go with another ubiquitous file format; Rich Text Format, the full specification can be downloaded from Microsoft

Below is a simple template which outputs a Rich Text Formatted file showing the last 5 entries from your blog.

{\rtf
{\b <MTBlogName>}
\par
<MTEntries lastn="1">
Author: <MTEntryAuthorNickname encode_xml="1">
\par
Modified: <MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ">
\par
</MTEntries>
\par
\par    
<MTEntries lastn="5">
{\b <MTEntryTitle>}
\par
<MTEntryBody  convert_breaks="0" remove_html="1">
\par
\par
</MTEntries>
}

you need to create a new custom index template and paste the above code in. Set the output file to recent.rtf. When this template is published it generates a rich text format file at your blog root that contains the last 5 entries in your blog.

This technique can be used for a number of different formats; OOXML, LaTex or OpenDocument for example. It can also be expanded to include a list of recent comments or limit the report to specific tags, categories or keywords.

Leave a comment

Gallery

Recent Entries

  • Now on YouTube

    Once in while, when answering questions on the Movable Type IRC channel or the support forums I find it easier to show rather than tell,...

  • Using jQuery with Movable Type

    Introduction jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development Today...

  • HashTag now on GitHub

    I have moved the source code for HashTag from my private SVN over to GitHub. If you want to contribute any changes you can find...

  • HashTag 2.5 Released

    Version 2.5 of my HashTag plugin has now been released. See the Hash Tag Plugin project page for more information. The major change in 2.5...

  • Hash Tag Beta 2.5 Now With Scheduled Post Support

    I have now added support for scheduled publishing in my HashTag plugin. It is currently a beta and can be downloaded from this link HashTag...

Close