SmartBody Plugin

MTSmartBody is a Movable Type plugin that inserts a post’s excerpt if it has one and the post’s body if it doesn’t.

A bonus tag included with MTSmartBody is the container tag MTEntryIfExcerpt. The contents of this tag will be displayed if an entry has an excerpt.

Why would you want such a thing? It’s a useful replacement to auto-generated excerpts. In your RSS file or your main index template, it would be nice to display the excerpt if you wrote one, but you’d rather not see a truncated copy of your post used if you don’t have an excerpt.

Tim Appnel has taken over the maintenance and support of this plugin as of Oct 2004.

Download

You can get SmartBody by downloading SmartBody.zip.

Installation. Once you’ve downloaded and unzipped SmartBody.zip, connect to your FTP server and open the directory where you have Movable Type installed.

Create a directory there called plugins if there isn’t one already.

Copy SmartBody.pl to the plugins directory and set the permissions to 755.

Using MTSmartBody

Once you’ve installed MTSmartBody, using it is as simple as placing a new Movable Type tag in your template.

The <MTEntrySmartBody> and <MTEntryIfExcerpt></MTEntryIfExcerpt> tags go between the <MTEntries></MTEntries> tags. MTSmartBody will check to see if an entry has an excerpt and insert it if it does, or insert the body if it doesn’t.

MTEntryIfExcerpt will also check to see if an entry has an excerpt and insert the contents of the tag if it does.

Example:

<MTEntries> 
	<MTEntrySmartBody> 
	<MTEntryIfExcerpt>
	<br><a href="<$MTEntryLink$>">Read more...</a>
	</MTEntryIfExcerpt>
</MTEntries>

License. Like our other freeware, this plugin is released under the open-source MIT License. In plain English, that means you can do whatever you want with the software, including modifying it, selling it, or eating it, but we’re not responsible for anything that goes wrong.

Revision History

1.0 - July 2, 2002
Initial release.

Vix
July 6, 2002 6:50 PM

This is exactly what i need for one of my sites! Thank you!!

Frank
July 13, 2002 9:57 AM

Hmm, doesn’t the MTSmartBody have to be closed?

I’m going to try it out now… so, I guess I’ll find out in a minute.

Frank
July 13, 2002 10:05 AM

Indeed… it doesn’t have to be closed. MT working with container tags and all, that seems a bit confusing to me.

Besides, I use it in the individual entry archives, so I don’t even have the MTEntries tags in there, just the MTBody tags and all. It seems to work just fine without the MTEntries tag being there though.

Adam Kalsey
July 13, 2002 10:48 AM

MTSmartBody is used just like MTEntryBody. It doesn’t need to be closed, and can be used anywhere MTEntryBody is used.

ABoyCalled3
August 17, 2002 12:15 PM

Very cool idea and I appreciate your sharing the code. That said, I can’t get MTSmartBody to work.

I’m running 2.21, tested plugins by using the load.pl script from the manual and it worked, but using the code snippet given in the example gives me only a link to the individual entry that says “Read more…” if I’ve created an excerpt.

IOW, MTEntryIfExcerpt seems to work but MTSmartBody does not. Is there some precedent for this?

Adam Kalsey
August 17, 2002 10:26 PM

If you look at the HTML file created by your template, what is in the place where the SmartBody tag is at?

I’m assuming that you have an entry body or excerpt on the post. Otherwise the IfExcerpt tag wouldn’t have worked.

I haven’t had anyone mention that it didn’t work for them, but I’ve looked over the plugin and made a few changes that may help. Try downloading it again and see if it works for you now.

ABoyCalled3
August 18, 2002 8:04 AM

Thanks for your quick response. In the HTML generated by my template there is nothing at all in the place where the Smartbody tag has been placed.

I can’t include the full code snippet because this space allows for text-only posts, but the snippet that calls MTSmartBody and MTEntryIfExcerpt is the same as in the example above (though I’ve switched “br” to “br /”).

See:

http://www.thetoplessreview.com/archives/auth_brett.html

Again, thanks for sharing this code with the MT community.

Tiziano
September 15, 2002 9:17 AM

Hi, I’m having the same problem with version 2.21 Did you manage to solve if?

girlie
November 9, 2002 11:46 AM

I had to write the tag as MTEntrySmartBody to get it to work???

Adam Kalsey
November 9, 2002 6:12 PM

Umm. Yeah. Hmm.

I’m not sure how I managed to miss that one. And for so long. The correct tag is MTEntrySmarBody. I’ve fixed the documentation.

Actually, this falls into the category of a plugin that I wrote for my own usage and then decided to make it available to everyone else too. I’ve got a few more of those, but I don’t really feel like writting the documentation and supporting them.

Nardo
November 19, 2002 4:40 AM

The plugin works… but where I had paragraphs in my entries before, none now!

Seems like the MTEntrySmartBody tag doesn’t transform a couple of line breaks into another paragraph?

Anyone else find this?

Adam Kalsey
November 19, 2002 7:24 PM

That’s correct. The plugin is pretty much no-frills. I wrote it for a specific purpose of mine and only threw it out here on the off chance that someone else might find it useful.

If you need breaks, try using Brad Choate’s format breaks plugin: http://www.movabletype.org/cgi-bin/ikonboard/ikonboard.cgi?s=3ddaffd30ccfffff;act=ST;f=20;t=6348;hl=format+breaks

Trackback from la rawr de los muertos
November 19, 2003 7:18 PM

I'm Gwen and I'm awesome!

Excerpt: Kalsey's SmartBody plugin and a few tweaks

Trackback from la rawr de los muertos
November 19, 2003 7:19 PM

I'm Gwen and I'm awesome!

Excerpt: Kalsey's SmartBody plugin and a few tweaks

brian
December 26, 2004 9:27 PM

hey,

great idea. i’m running v3, and use the plugin but whenever i do the formatting is completely off - it switches for left to centered and the fonts change. am i missing something?

This discussion has been closed.

Follow me on Twitter

Lijit Search

Best Of

Recently Read

Get More

Subscribe | Archives

Recently

Ideas, Risk, and Investors (Jan 1)
Over at SacStarts, I have piece up discussing a common question I get from entrepreneurs....
VoiceXML for web developers (Dec 17)
Building voice applications isn't hard at all. Any web developer can do it.
De-skunking a dog (Oct 27)
How to clean up your pet after a skunk attack.
Pressure sales via Twitter (Oct 16)
Sticking an ad in my face when we first meet is a good way to lose my interest.
Loma Prieta, 20 years later (Oct 13)
Looking at the earthquake from October 17, 1989
Red light cameras don't work (Oct 13)
Cameras installed to catch people running red lights aren't about traffic safety at all.
Jack-o-lantern pumpkin carving patterns (Oct 12)
It's a tradition, what can I say?
SEO realities (Oct 12)
The real search engine optimization. Works every time.

Subscribe to this site's feed.

Elsewhere

IMified
Build instant messaging applications. (My company)
SacStarts
The Sacramento technology startup community.
Pinewood Freak
Pinewood Derby tips and tricks

Contact

Adam Kalsey

Mobile: 916.600.2497

Email: adam AT kalsey.com

AIM or Skype: akalsey

Resume

PGP Key

©1999-2010 Adam Kalsey.
Content management by Movable Type.