June 12, 2005

Simple RSS Customizations

Updated June 12, 2005. Originally posted in Spring of 2004.

The default Movable Type installation automatically publishes RSS feeds for your weblog. The three formats supported are Atom, RSS 1.0 and RSS 2.0. You can find the templates associated with these syndication formats in the templates section of your MT edit screen.


The default RSS 1.0 and RSS 2.0 syndication feed templates for MT version 3.x produces a feed with the content in your MT entry body. The default Atom feed template produces a feed with both the entry body and the extended entry. The default RSS 1.0 and RSS 2.0 feeds in MT version 2.661 generated feeds with only the entry excerpt.

You may or may not want to publish full feeds for your weblog. There is an ongoing debate about this as avid weblog readers who use newsfeed readers generally prefer to get the full feeds of the weblogs they read. The flip side for the weblog publisher is that publishing full entry feeds can use up more bandwidth from your webhost, unless you use a service like Feedburner to host your feeds. Also, once you release all of your content in a full feed, it is very easy for an aggregator to automatically pull all of your content into their pages. Even if you have copyright protection noted on your entries, that may not stop people from using your content to create their own automatically generated portal sites. It is up to you, the weblog publisher, to determine how much of your content you want to make instantly and easily available to others without requiring them to come to your website.

Here are some simple changes you can make to your feed templates to generate a full entry feed, including the extended entry, to reduce the Atom feed to only the entry body, to create an RSS feed for a specific category or by using your RSS 2.0 template to include comments with your feed.

Changing from entry body to entry body plus extended entry

For both the RSS 1.0 and RSS 2.0 index templates, find the second instance of the description tag in the templates. In both templates that code should look like this:

<description><$MTEntryBody encode_xml="1"$></description>

Change this line so that it now reads:

<description><$MTEntryBody encode_xml="1"$>
<$MTEntryMore encode_xml="1"$></description>

Save and rebuild your templates.

Changing from full entry to entry body or entry excerpt in the Atom feed

If you want to reduce your Atom feed to only showing the entry body and not the full extended entry, find the following code in your Atom Index:

<$MTEntryBody encode_xml="1"$>
<$MTEntryMore encode_xml="1"$>

Delete the <$MTEntryMore encode_xml="1"$> line.

If you want to change your Atom feed to only showing the entry excerpt, remove those two lines and add <$MTEntryExcerpt encode_xml="1"$> in their place.

Save and rebuild your template.

Providing an RSS feed for a category.

If you would like to create RSS feeds for all of your categories, see Shelley's tips in her Generate RSS Feeds by Category tutorial.

Alternatively you can publish an RSS feed for just one specific category of posts from your weblog. For example, I publish an RSS feed for my recipe site as well as for the low carb recipes on that site. Here is the method I use, using the RSS 1.0 template. First copy and paste the RSS 1.0 Index template into a new Index template. Name the new index file something different and name the output file something other than index.rdf, for example index_yourcategory.rdf.

In your new RSS index template, find the following code:

<rdf:Seq><MTEntries lastn="15">
<rdf:li rdf:resource="<$MTEntryPermalink encode_xml="1"$>" />


<MTEntries lastn="15">
<item rdf:about="<$MTEntryPermalink encode_xml="1"$>">
<title><$MTEntryTitle encode_xml="1"$></title>
<link><$MTEntryPermalink encode_xml="1"$></link>

Add a category attribute to the two MTEntries tags, with the name of the category you have selected to create a feed. In the following example from my recipe website I am creating a feed for my Low Carb recipes:

<rdf:Seq><MTEntries lastn="15" category="Low Carb">
<rdf:li rdf:resource="<$MTEntryPermalink encode_xml="1"$>" />


<MTEntries lastn="15" category="Low Carb">
<item rdf:about="<$MTEntryPermalink encode_xml="1"$>">
<title><$MTEntryTitle encode_xml="1"$></title>
<link><$MTEntryPermalink encode_xml="1"$></link>

You may want to change the title of the feed as it would appear in a newsreader. To do so, find this part of the code in your new RSS index template:

<channel rdf:about="<$MTBlogURL$>">
<title><$MTBlogName encode_xml="1"$></title>

Add the name of your category to the title:

<channel rdf:about="<$MTBlogURL$>">
<title><$MTBlogName encode_xml="1"$>: THE NAME OF YOUR CATEGORY</title>

Save and rebuild your template.

Including Comments With Your Feed

In addition to updated entries in your RSS feed you can also include in that feed new comments to your most recent entries. Here is an RSS 2.0 template that I am now using for LMT that includes the main body post, a link to the extended entry (if there is one), and any new comments made to the last "n" entries. (Via Arvind at Movalog and Jennifer at etc.)

<?xml version="1.0" encoding="iso-8859-1"?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">

<title><$MTBlogName remove_html="1" encode_xml="1"$></title>
<description><$MTBlogDescription remove_html="1" encode_xml="1"$></description>
<dc:creator><MTEntries lastn="1"><$MTEntryAuthorEmail$></MTEntries></dc:creator>
<dc:rights>Copyright <$MTDate format="%Y"></dc:rights>
<dc:date><MTEntries lastn="1"><$MTEntryDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></MTEntries></dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=<$MTVersion$>" />
<admin:errorReportsTo rdf:resource="mailto:<MTEntries lastn="1"><$MTEntryAuthorEmail$></MTEntries>"/>

<MTEntries lastn="15">
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<link><$MTEntryLink encode_xml="1"$></link>
<description><$MTEntryExcerpt remove_html="1" encode_xml="1"$></description>
<guid isPermaLink="false"><$MTEntryID$>@<$MTBlogURL$></guid>
<content:encoded><![CDATA[<$MTEntryBody$><MTEntryIfExtended><p><a href="<$MTEntryLink$>" title="Continue Reading: <$MTEntryTitle$>">Continued reading <$MTEntryTitle$>...</a><p class="font-family:Verdana, Arial, sans-serif; font-size:11px; color: #333333; background-color: #f5f5f5; border: 1px solid #c0c0c0; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 4px; display: block;"></MTEntryIfExtended></p>
<MTEntryIfAllowPings><a href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">TrackBack (<$MTEntryTrackbackCount$>)</a> | </MTEntryIfAllowPings><MTEntryIfAllowComments><a href="<$MTEntryLink$>#comments" title="Comment on: <$MTEntryTitle$>">Comments (<$MTEntryCommentCount$>)</a></p>
<p>Comments on this Entry:</p>

<MTComments><p>(<MTCommentAuthorLink show_email="0" > on
<MTCommentDate format="%b %e, %Y %l:%M %p">)

<MTCommentBody convert_breaks="0"
<dc:subject><$MTEntryCategory remove_html="1" encode_xml="1"$></dc:subject>
<dc:date><$MTEntryDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></dc:date>


Just replace your existing RSS 2.0 template with the above and you will generate a feed that includes the entry body text and comments. (But don't ask me how this code works, I'm just using a template I found somewhere else!)

If you have a useful MT syndication feed template that you would like to share with others, please let me know about it in the comments.


RSS Specifications - "everything you need to know about RSS"
Generate RSS Feeds by Category - Girlie's tip on how to easily generate RSS feeds for all of your categories by incorporating a new RSS template with a new archiving type.
Sideblog RSS - tip for making your linkblog's RSS feed to direct the title of your entry to the linked page itself, rather than your linkblog.
Comments-only Feed - scroll to the bottom of the page to get the RSS template for a comments-only RSS feed.
Forcing an Unsubscribe

Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://learningmovabletype.com/ . Thanks!

Posted by Elise Bauer on June 12, 2005 to RSS
Comments(11) | Email to a friend | Printer-friendly version


If you would like to send a trackback
please use the following URL: http://learningmovabletype.com/cgi-bin/mt32/mt-tb.cgi/226

» RSS customizations from Disarranging Mine
Elise of Learning Movable Type has put together an excellent tutorial for customizing the RSS feeds that come with MovableType. Specifically, she explains in easy terms how to make full......[read more]

Tracked: August 18, 2004 08:28 PM

» short or long summaries? from Silk and spinach
I'm in a bit of a quandary, and I would therefore like to enlist your opinion, dear reader. As things currently stand, this blog generates Atom and RSS feeds that include the whole text of each post. And each of the indexes (the category indexes, the m......[read more]

Tracked: December 27, 2004 01:26 PM

» Updated RSS Feeds from Michael Williams -- Master of None
I've updated my RSS feeds to be more feature-rich. You can use these feeds with an RSS aggregator, most of which are free. RDF RSS Feed (RSS 1.0) XML RSS Feed (RSS 2.0) (HT: Ben Hammersley and Learning Movable Type.)......[read more]

Tracked: May 10, 2005 05:08 PM

» My web feeds templates from Knowledge Jolt with Jack
Several people asked for the templates for my web feeds, particularly the one that provides comments interspersed with the entries. Here it is....[read more]

Tracked: June 18, 2005 08:44 PM

» Adding Footers to Your Feed from Plagiarism Today
If, like many, you've grown weary of the rampant automated plagiarism going on and want to protect your RSS feed from skimming or scraping, then adding copyright footers to each article is a potential solution to the problem. However, that can be a......[read more]

Tracked: September 15, 2005 03:40 PM


Thanks for the explanation.

I suggest you this rdf-template I made for comments in MT.

It's *very useful* to encourage discussions between bloggers.


(text is in french but of course, the template work also in english)

So, on my blog, bottom of right side, there is two rss links: one for entries, the other for comments.

Do you know how to add an image so that it shows up next to the title of your blog or in place of the title of the blog.

I use bloglines and several of the feeds I read do that.

when people have only excerpts in their rss it annoys me cos I use feeddemon but oh well. With the category rss instead of being an index template each on their own - with a lot of categories u could have a lot of index templates - you could implement this tip for girlie http://www.thegirliematters.com/tips/archives/0305/generate_rss_feeds_by_category.php this way u create the rss via a archive template, same amount of files are created just doesn't build up your mt templates page ;)

Clement - thanks for the link!

Blinger - I don't know that trick, sounds like a good one.

Arvind - Thanks for pointing me to Girlie's tip, I've added it to the links above.

Blinger - For the images I did it in my rss 2.0 feed sample code :

Title text for href link
Location of image
<link>image href to page</link>
<description>ALT Text</description>

I've tried the tip about editing the description tag and keep getting the follwoing error when I attempt to rebuild: "Build error in template 'RSS 1.0 Index': Error in tag: You used an 'MTEntryBody' tag outside of the context of an entry; perhaps you mistakenly placed it outside of an 'MTEntries' container?"

Any ideas what's going on?

I figured it out. There's two description tags in the index.rdf template. I edited the first one. I should have edited the second one instead.

Per your instructions above regarding the comments showing up in the RSS feed, I replaced my RSS 2.0 feed with the code you had, however it's not working for me.

This is the error I get:
XML Parsing Error: xml processing instruction not at start of external entity
Location: *deleted because this is just a test site I'm using*
Line Number 2, Column 1:
<?xml version="1.0" encoding="iso-8859-1"?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">

Any ideas? Thanks in advance.

Question in my RSS feed, I want to include my hrefs from my Entry Excerpts. However, I can not get it to work.

I have tried and other methods to no avail.

The best place to post questions regarding RSS feeds for your MT weblog is in the Support Forums. There are some people who actually understand RSS there. I don't really. I just fiddle with things until they work well enough. Half the time I'm probably not doing it right. In fact, if anyone cares to comment on what I have written above and explain it more to folks (including any errors in what I have written) please do so! It would be a service to all of us.

I've figured out how to set up category feeds in MT 3.2, and have written it up:


Post a comment

(Before posting a comment please see the Comments and Trackbacks Policy. Do you need help troubleshooting your weblog? Please post questions and requests for support at the MT Support Forums. Thanks!)

Remember Me?

(you may use HTML tags for style)

Email to a friend

Email this article to:

Your email address:

Message (optional):