TemplateToolkit
1

[%- USE date -%]
Status: 200 OK
Content-Type: application/rss+xml;charset=utf-8

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns="http://purl.org/rss/1.0/"
         xml:lang="en">

<!--  NOTICE
 !==============
 !
 ! This content is not made available for the purpose of syndication.
 ! It is only made available for personal use. If you want to
 ! republish this content please ask for permission.
 !
 !-->

 <channel rdf:about="[% app.canonicalURI | html %]?command=RSS">
  <title>[% app.name %]</title>
  <link>[% app.canonicalURI %]</link>
  <description>[% app.description %]</description>
  <items>
   <rdf:Seq>
[% FOREACH post = posts %]
   [%- post.uri = BLOCK %][% app.canonicalURI | html %]?start=[% post.stamp | uri %]&count=1[% END -%]
    <rdf:li resource="[% post.uri | html %]"/>
[% END -%]
   </rdf:Seq>
  </items>
 </channel>

[% IF encoding.defined %]
  [%- SET asHTML = encoding == 'html' %]
[%- ELSE %]
  [%- SET asHTML = input.arguments.format.0 == 'with-html' %]
[%- END %]

[%- FOREACH post = posts -%]
 <item rdf:about="[% post.uri | html %]">
  <title>[% post.title | html %]</title>
  <link>[% post.uri | html %]</link>
  <dc:date>[% date.format(post.stamp, '%Y-%m-%dT%H:%M:%S+00:00') | html %]</dc:date>
[% IF asHTML -%]
  <description>[% post.content | html %]</description>
[% ELSE -%]
  <description>[% post.description | html %]</description>
[% END -%]
 </item>
[% END -%]

</rdf:RDF>
