Need someone to lead product management at your software company? I create software for people that create software and I'm looking for my next opportunity. Check out my resume and get in touch.

SmartBody Plugin

Freshness Warning
This blog post is over 21 years old. It's possible that the information you read below isn't current and the links no longer work.

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.

Recently Written

Too Big To Fail (Apr 9)
When a company piles resources on a new product idea, it doesn't have room to fail. That keeps it from succeeding.
Go small (Apr 4)
The strengths of a large organization are the opposite of what makes innovation work. Starting something new requires that you start with a small team.
Start with a Belief (Apr 1)
You can't use data to build products unless you start with a hypothesis.
Mastery doesn’t come from perfect planning (Dec 21)
In a ceramics class, one group focused on a single perfect dish, while another made many with no quality focus. The result? A lesson in the value of practice over perfection.
The Dark Side of Input Metrics (Nov 27)
Using input metrics in the wrong way can cause unexpected behaviors, stifled creativity, and micromanagement.
Reframe How You Think About Users of your Internal Platform (Nov 13)
Changing from "Customers" to "Partners" will give you a better perspective on internal product development.
Measuring Feature success (Oct 17)
You're building features to solve problems. If you don't know what success looks like, how did you decide on that feature at all?
How I use OKRs (Oct 13)
A description of how I use OKRs to guide a team, written so I can send to future teams.

Older...

What I'm Reading

Contact

Adam Kalsey

+1 916 600 2497

Resume

Public Key

© 1999-2024 Adam Kalsey.