Using rah_external_output you can create just about any feed you would want. I needed to create a feed for a specific author.
Let’s get started
First, create a new output with a Content Type of text/xml.
The Textpattern tags I would use to get the articles for this author are:
<txp:article_custom
allowoverride="0"
limit="10"
pgonly="0"
author="AUTHORNAME"
section="articles">
I can then add the code needed to create feed items for each of these articles. This could be in a form or to keep things simple used within a txp:article
container tag.
Feed items
<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>
The body could be replaced with excerpt if desired.
Final code
Now we need to add the remaining RSS feed to get 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/" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
<generator>http://textpattern.com/</generator>
<title><txp:site_name /></title>
<link><txp:link_to_home /></link>
<description><txp:site_slogan/></description>
<pubDate><txp:php>echo strftime( "%a, %d %b %G %T %Z" );</txp:php></pubDate>
<atom:link href="<txp:site_url/>?rah_external_output=OUTPUT_NAME" rel="self" type="application/rss+xml" />
<txp:article_custom allowoverride="0" limit="10" pgonly="0" author="AUTHORNAME" section="articles">
<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>
</txp:article_custom>
</channel>
</rss>
Note: It’s important to remember that the AUTHORNAME is the Author’s username, and OUTPUT_NAME should be the name given when creating the rah_external_output item.
You can actually simply the date format a little. RSS recognizes the rfc822 format, which TXP allows you to natively render inside the
format
attribute instead of using PHP’s strftime. So just use this:…. instead of manually recreating the time stamp.