Leo's MovableType Tips

by Leo A. Notenboom

by Ask Leo!

Repurpose the Excerpt

I found myself wanting to add a "Summary" for each article on Ask Leo! The summary is written by hand for each article - partly for the search engines, and partly to help people decide whether the article is, in fact, what they're looking for.

One complicating factor is that with over 860 articles, I wasn't about to add summaries for most. So I wanted summaries to be visible only if a summary had, indeed been written.

As we all know, there is no "Summary" field in MovableType, instead there's something called an "Excerpt". Excerpt serves my purposes well, but only after a minor configuration change.

In my Individual Entry Archive template, I now include the following:

<MTIfNonEmpty tag="EntryExcerpt">
<p style="..."><b>Summary</b>: <$MTEntryExcerpt$></p>
</MTIfNonEmpty>

That seems fairly straightforward, right? There's only one problem. The Excerpt is, by default, automatically generated from the first 'n' words of your content if not explicitly supplied. As a result, the tag was always non-empty, and every article had a "Summary", whether or not I had written one.

The solution turned out to be fairly simple.

In the Settings for the weblog, I set Excerpt Length to zero.

Now, the default Excerpt is, indeed, empty. If I purposely fill in the Excerpt, then it exists, and the condition in my template triggers, and the Excerpt ... no, Summary ... appears.

I know that there are other plug-ins for MT that allow you to add additional fields to each entry, but I thought this was a rather convenient use of built-in functionality to effectively re-purpose the Excerpt field.

But, of course, you can only do that once. As soon as I need something in addition to my Summary, I'll be looking at other options.