I sat down a few hours ago to start a droplet which would generate an RSS feed based on data in an ATG Repository. Surprisingly, I think I’m done.
Basically what it is is a droplet, which you put on an otherwise empty JSP page (it’s important that there is no whitespace on the JSP as well). You configure the droplet via it’s .properties file to point to a Repository, and you give it an item descriptor, which will be the primary item to use for the data in the feed. You then configure a bunch of mostly optional data points for the channel data of the RSS feed (this includes things like the main site link, the RSS feed title and description, and optional elements like author, copyright information, etc…
Then you provide the property names (and nested “.” driven properties are okay here) for the various elements of the RSS Item like title, link, description, publish date, etc… Currently it sorts based on the publish date property, to provide items in newest-to-oldest order. I may support a separate sort property later on if people want one.
Since many repository items may not have a usable link property, you can pass in a itemLink property value with an embedded property (also supporting nested properties, and supporting the special repositoryId). For instance you can do this:
itemLink=/catalog/product.jsp?productId=#{repositoryId}
or even something like:
itemLink=http://#{author.homepageURL}?referrer=mySite
The JSP page, when hit, generates a nice RSS 2.0 compliant feed based on the data in the Repository.
You can also include the following in your <head> element of your site’s main page to get the nice automatic feed discovery in many browsers:
You can download the entire package here. This includes the source, a heavily commented properties file, a jsp file, and a jar file to load into your classpath.
Some examples where you might want to use this: Blog, Newsletter, any site with updated content, a commerce site’s catalog, discussion forums, etc…..
Enjoy!
Leave a Reply