SmartBody Plugin

Freshness Warning
This blog post is over 19 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

The Trap of The Sales-Led Product (Dec 10)
It’s not a winning way to build a product company.
The Hidden Cost of Custom Customer Features (Dec 7)
One-off features will cost you more than you think and make your customers unhappy.
Domain expertise in Product Management (Nov 16)
When you're hiring software product managers, hire for product management skills. Looking for domain experts will reduce the pool of people you can hire and might just be worse for your product.
Strategy Means Saying No (Oct 27)
An oft-overlooked aspect of strategy is to define what you are not doing. There are lots of adjacent problems you can attack. Strategy means defining which ones you will ignore.
Understanding vision, strategy, and execution (Oct 24)
Vision is what you're trying to do. Strategy is broad strokes on how you'll get there. Execution is the tasks you complete to complete the strategy.
How to advance your Product Market Fit KPI (Oct 21)
Finding the gaps in your product that will unlock the next round of growth.
Developer Relations as Developer Success (Oct 19)
Outreach, marketing, and developer evangelism are a part of Developer Relations. But the companies that are most successful with developers spend most of their time on something else.
Developer Experience Principle 6: Easy to Maintain (Oct 17)
Keeping your product Easy to Maintain will improve the lives of your team and your customers. It will help keep your docs up to date. Your SDKs and APIs will be released in sync. Your tooling and overall experience will shine.

Older...

What I'm Reading

Contact

Adam Kalsey

+1 916 600 2497

Resume

Public Key

© 1999-2022 Adam Kalsey.