Web Script: org/alfresco/modules/blog/rss/postlist-rss.get
Generated from /share/service/script/org/alfresco/modules/blog/rss/postlist-rss.get on Jun 14, 2026 2:45:18 PM

Script Properties
Id:org/alfresco/modules/blog/rss/postlist-rss.get
Short Name:Blog RSS
Description:Blog: RSS of list of blog posts
Authentication:user
Transaction:required
Method:GET
URL Template:/components/blog/rss
Format Style:any
Default Format:rss
Negotiated Formats:[undefined]
Implementation:class org.alfresco.web.scripts.DeclarativeWebScript
Extensions:[undefined]

Store: classpath:alfresco/site-webscripts

File: org/alfresco/modules/blog/rss/postlist-rss.get.desc.xml
<webscript>
  <shortname>Blog RSS</shortname>
  <description>Blog: RSS of list of blog posts</description>
  <url>/components/blog/rss</url>
  <format default="rss"/>
  <authentication>user</authentication>
</webscript>
File: org/alfresco/modules/blog/rss/postlist-rss.get.js
function convertPostJSONData(post)
{
   // created
   var created = new Date(post["createdOn"])
   post["createdOn"] = created;
   
   // modified
   if (post["modifiedOn"] != undefined)
   {
      var modified = new Date(post["modifiedOn"]);
      post["modifiedOn"] = created;
   }
   // released
   if (post["releasedOn"] != undefined)
   {
      post["releasedOn"] = new Date(post["releasedOn"]);
   }
   // updated
   if (post["updatedOn"] != undefined)
   {
       post["updatedOn"] = new Date(post["updatedOn"]);
   }
   // last comment
   if (post["lastCommentOn"] != undefined)
   {
      post["lastCommentOn"] = new Date(post["lastCommentOn"])
   }
}

/**
 * Converts the data object from strings to the proper types
 * (currently this only handles strings
 */
function convertPostsJSONData(data)
{
   for (var x=0; x < data.items.length; x++)
   {
      convertPostJSONData(data.items[x]);
   }
}

function main()
{
   // gather all required data
   var site = args["site"];
   var container = (args["container"] != undefined) ? args["container"] : "blog";
   
   var url = '/api/blog/site/' + site + '/' + container + "/posts?contentLength=512";
   
   var connector = remote.connect("alfresco-feed");
   var result = connector.get(url);
   if (result.status != status.STATUS_OK)
   {
      status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Unable to do backend call. " +
                     "status: " + result.status + ", response: " + result.response);
      return null;
   }
   var data = eval('(' + result.response + ')');
   convertPostsJSONData(data);
   model.items = data.items;

   // set additional properties
   var lang = "en-us";
   model.lang = lang;
   model.site = site;
   model.container = container;
}

main();
File: org/alfresco/modules/blog/rss/postlist-rss.get.properties
#
#   file postlist-rss.get.rss.ftl
#
postlistrss.title=Blog Posts
postlistrss.description=RSS feed of the blog posts
postlistrss.noposts=No blog posts created yet
postlistrss.draft=Draft
File: org/alfresco/modules/blog/rss/postlist-rss.get.rss.ftl
<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>${msg("postlistrss.title")}</title>
      <link>${absurl(url.context)}/service/components/blog/rss?site=${site}&amp;container=${container}</link>
      <description>${msg("postlistrss.description")}</description>
      <language>${lang}</language>

      <#if (items?size > 0)>
         <#list items as post>
            <item>
               <title><#if post.isDraft>${msg("postlistrss.draft")}: </#if>${post.title?html}</title>
               <link>${absurl(url.context)}/page/site/${site}/blog-postview?container=${container}&amp;postId=${post.name}</link>
               <description>${post.content?html}</description>
               <#if (! post.isDraft)>
                  <#-- make sure we use en_US for date rendering -->
                  <#assign currentLocale=locale />
                  <#setting locale="en_US" />
                  <pubDate>${post.releasedOn?datetime?string("EEE, dd MMM yyyy HH:mm:ss Z")}</pubDate>
                  <#setting locale=currentLocale />
               </#if>
            </item>
         </#list>
      <#else>
         <item>${msg("postlistrss.noposts")}</item>
      </#if>
   </channel>
</rss>

Store: classpath:alfresco/webscripts

[No implementation files]