cancel
Showing results for 
Search instead for 
Did you mean: 

Creating RSS feed using Freemarker in Web Form

samsteinig
Champ in-the-making
Champ in-the-making
I'm trying to create an RSS feed using a web form.  For example, in one of our sites, we have a web form for blog entries.  The web form contains an ftl that lists links to all previous entries, which is what I'm trying to use to build an RSS xml file.  The resultant RSS xml file shows no entries.  I created an html (non-RSS) version of the ftl as a test, and it works fine.  Below is code for both the html and RSS versions of the ftl; hopefully I'm making a very basic mistake. 

FTL Code for RSS file (doesn't work; just a blank RSS page with no listed items, no errors):

<#ftl ns_prefixes={"D", "http://www.alfresco.org/alfresco/g"}>
<?xml version="1.0" ?>
<rss version="2.0">
<channel>
  <#assign docs = alf.parseXMLDocuments('sustain_blog_01', '/sustain/blog/2011')>
  <#list docs?sort_by("date")?reverse as x>
    <item>
      <title>${x.page_title}</title>
      <link>${x.file_name}.html</link>
      <pubDate>${x.date}</date>
    </item>
  </#list>
</channel>
</rss>

FTL Code for HTML test version (this DOES work):

<#ftl ns_prefixes={"D", "http://www.alfresco.org/alfresco/g"}>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<body>
  <#assign docs = alf.parseXMLDocuments('sustain_blog_01', '/sustain/blog/2011')>
  <#list docs?sort_by("date")?reverse as x>
   
    ${x.page_title}<br>
    <a href="${x.file_name}.html">${x.file_name}.html</a><br>
    ${x.date}<hr>
   
  </#list>

</body>
1 REPLY 1

samsteinig
Champ in-the-making
Champ in-the-making
Never mind… problem fixed…  I had the wrong close tag on pubDate:

<pubDate>${x.date}</date>