AnsweredAssumed Answered

RSS Feed Question

Question asked by andream on Jan 21, 2014
Latest reply on Jan 28, 2014 by scouil
RSS Feed Question - How do you define number of posts displayed on a RSS feed? The FTL file code we are using is below:

FYI: I'm not the developer. This was created by a IT contractor who helped us set-up our Alfresco CMS.

<#ftl ns_prefixes={"news", "http://www.webbynews.ca/news"}>
<#assign news = .vars["news:news"]>
<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
   <channel>
      <title>Webby News</title>
      <link>http://www.webbynews.ca</link>
      <description>Webby News</description>

      <#assign articleList = null>
      <#list alf.parseXMLDocuments('Webby News', '/news/xml/') as x>
         <#assign xmlname = x["@alf:file_name"]>   
         <#assign article_path = "/news/xml/" + xmlname>
         <#assign listarticle=alf.parseXMLDocument(article_path)>
         <#assign jspLink = xmlname?string?substring(0, xmlname?string?index_of(".xml"))+ ".jsp">
         <#assign articleList = articleList+ [{"title":listarticle["news:title"],"articledate":listarticle["news:active"] ,"url":jspLink ,"body":listarticle["news:content"] }]>
       </#list>
      
      <#list alf.parseXMLDocuments('WEBBY NEWS', '/news/xml/') as x>
         <#assign xmlname = x["@alf:file_name"]>   
         <#assign article_path = "/news/xml/" + xmlname>
         <#assign listarticle=alf.parseXMLDocument(article_path)>
         <#assign jspLink = xmlname?string?substring(0, xmlname?string?index_of(".xml"))+ ".jsp">
         <#assign articleList = articleList+ [{"title":listarticle["news:title"],"articledate":listarticle["news:active"] ,"url":jspLink ,"body":listarticle["news:content"] }]>
       </#list>

      <#list articleList?sort_by("articledate")?reverse as i>
         <item>
            <title>${i.title?string?replace("&","&amp;")}</title>
            <link>http://www.webbynews.ca/news/articles/${i.url}</link>
            <description>${i.body?string?replace("<","&lt;")?replace(">","&gt;")}</description>
         </item>
      </#list>
   </channel>
</rss>

Outcomes