While trying to create a more reliable RSS feed, I bumped into several solutions. I’ve put it all together and developed this one:
{assign_variable:master_weblog_name="blog|technology|science"}
{exp:rss:feed weblog="{master_weblog_name}"}
<?xml version="1.0" encoding="{encoding}"?>
<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/">
<channel>
<title>{exp:xml_encode}{weblog_name}{/exp:xml_encode}</title>
<link>{weblog_url}</link>
<description>{weblog_description}</description>
<dc:language>{weblog_language}</dc:language>
<dc:creator>{email}</dc:creator>
<dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
<dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%Q"}</dc:date>
<admin:generatorAgent rdf:resource="http://expressionengine.com/" >
{exp:weblog:entries weblog="{master_weblog_name}" limit="10" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
<item>
<title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
<link>{title_permalink=blog/post}</link>
<guid>{title_permalink=blog/post}</guid>
<description>
<![CDATA[
{summary}{body}
<hr >
Categories: {categories}<a href="http://{site_url}/blog/category/{category_url_title}/">{category_name}</a>{/categories}
Tags: {exp:tag:tags entry_id="{entry_id}" type="weblog" orderby="alpha" sort="asc" backspace="2"}<a href="http://{site_url}/tags/tag/{websafe_tag}/">{tag}</a>, {/exp:tag:tags}
<a href="http://api.tweetmeme.com/share?url={site_url}blog/post/{url_title}">http://api.tweetmeme.com/imagebutton.gif?url={site_url}blog/post/{url_title}</a>
]]>
</description>
<dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i%Q"}</dc:date>
</item>
{/exp:weblog:entries}
</channel>
</rss>
{/exp:rss:feed}
Please compare this file with the default one at: http://expressionengine.com/templates/source/category/feeds/
Details:
1. The “|” in line 1 indicates more than one weblogs, in this example: blog, technology and science
2. In the first <dc:date> tag I removed the default %s because it makes an updated post reappear as a new one in feed readers. I also removed the #When:{gmt_entry_date format="%H:%i:%sZ"} in the <guid> tag for the same reason.
3. The CDATA declaration helps the feed understand the HTML tags in the relevant template. Without it in your feed reader you get text unformatted at all.
4. Inside the CDATA I added some real HTML code. In particular there’s a horizontal line and the the category and the tags of the post. Both are clickable and send you in the relevant category/tag in your website. In order to get the tags you ‘ve got to install the Solspace tag module.
5. The last tag includes the code you need in order to see in your reader the Tweetmeme button, which of course is clickable.
6. Since we have our clickable categories and tags we don’t need the following line
<dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}, {/categories}{/exp:xml_encode}</dc:subject>
which is a part of the default template.
Please feel free to test this template and make it better.
Two excellent sources:
- http://23rdworld.com/2009/12/23/how-to-fix-your-expressionengine-rss-template/ (this one explains how to make your published post not reappear as new in your feed reader after being edited.)
- http://www.ablognotlimited.com/articles/customizing-expressionengine-rss-template/ (this one explain how to include clickable categories and tags in your feed)