All other factors aside, Wordpress still has one up on Textpattern for custom RSS feeds – a function with quite a lot of potential. Textpattern doesn’t technically offer this capability, but it’s fairly simple to construct an alternative.
Step the First: Page/Section
Open up the Textpattern control panel and scoot over to the Pages area (under Presentation). Create a new page (or copy an existing page); save it as myrss or something clever.
Open up the Sections tab. Create a new section with the same name as your new-and-shiny page. After creating the section, find it in the section list and change the “Uses page” field to myrss. Twiddle with the other settings if you’re terribly bored; we won’t be needing them for anything.
Step the Second: Constructing the Feed
Back to Pages. Open up the myrss page. Delete everything in it, then copy in the following:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<generator>http://textpattern.com/</generator>
<title><txp:sitename /></title>
<link><txp:link_to_home /></link>
<pubDate><txp:php>echo strftime( "%a, %d %b %G %T %Z" );</txp:php></pubDate>
<txp:article_custom allowoverride="0" form="myrss" limit="5" pgonly="0" section="blog" />
</channel>
</rss>
(Note: change the section attribute of txp:article_custom to whatever section you want to be pulling articles from. Also – the presence of the PHP bit means that PHP parsing must be enabled for this to work properly. You can set this in Admin -> Preferences -> Advanced -> Publish -> “Allow PHP in pages?”.)
Save this, then move to the Forms tab.
Step the Third: Custom RSS Items
Open up a blank form (“Create new form”), then paste in the following:
<item>
<title><txp:title /></title>
<description>
<![CDATA[
<txp:body />
]]>
</description>
<link><txp:permlink /></link>
<pubDate><txp:posted format="%a, %d %b %G %T %Z" /></pubDate>
<dc:creator><txp:author /></dc:creator>
<guid><txp:permlink /></guid>
</item>
Name it myrss (or something different; you’ll need to change the page if you go all creative here). Change the form type to “Article” and save it.
Step the Fourth: Slack-Jawed Admiration
You’re done, actually. Or nearly. Load up domain.com/myrss and gaze in wonder.
Now take a step back. You’re here to trick out your feed, and thus far we’ve only created the framework. At this point, you can go back to the myrss article form and have your way with it – anything you put in into the <description> area will be used in the feed at /myrss (check my feed for an example). Article images are a common addition, but anything that Textpattern can do, your feed can use.
(Note: Don’t mess with anything other than <description> unless you know what you’re doing, btw. Feeds break easily.)
Epilogue: The Problem
The only issue with this technique is the content headers. A feed validator will tell you that it’s being served as text/html, and that this is bad. In theory, tacking <txp:php>header( "Content-type: text/xml", true);</txp:php> on to the beginning of the myrss page would fix this, but it doesn’t seem to have an effect. If anyone has any brilliant ideas, leave a note and I’ll add it/them to this article.
Mike has a plugin available that’ll take care of this – download it here. (Thanks, Mike)
In the meantime As an alternative, running the feed through Feedburner will solve your problems (and add even more functionality, actually).
Go in customized-Textpattern-rss peace.
(And yeah, that photo up above is entirely unrelated.)