Wednesday, August 19, 2015

AEM Custom Atom Feeds

This article is about generating atom feeds (based on QueryBuilder) on AEM, for purposes like integration with search engines like GSA, RSS feeds etc.

There are two options to achieve this.

  1. Customize the out of the box implementation. 
  2. Creating a new atom feed.

Approach 1 - Customize the OOTB component.

The out of the box implementation can be easily customized by overlaying and tweaking the feedentry.jsp & feed.jsp files at various levels as required by your atom feed. The levels could be like cq:Page, dam:Asset, Node, etc. You can locate the corresponding JSPs for each of these levels in the path below.

/libs/foundation/components/primary/cq/Page
/libs/foundation/components/primary/dam/Asset
/libs/foundation/components/primary/nt/folder
.etc.

Please note that you should not modify the contents of libs folder as per the AEM guidelines but you have to overlay the primary component (as a folder) by creating the same folder structure under /apps

To modify the feedentry.jsp, you need to understand how the atom feed tags work and also any other additional data you need to fetch from other JCR nodes in order to customize the feed.

Example: 
/apps/foundation/components/primary/cq/Page/feedentry.jsp

Finally, your custom feed will be available via the OOTB feed URL

http://<aemServer>:<aemPort>/bin/querybuilder.feed?orderby=@jcr:content/jcr:created&orderby.index=true&orderby.sort=desc&path=/content/xxx/xxx&type=cq:Page


Approach 2 - Create a new Atom feed

To create a brand new atom feed, you have to mimic the FeedServlet which comes out of the box. The custom FeedServlet will have to delegate the feed rendering task to your custom JSP like for example,  'myfeedentry.jsp' .

Again you have to overlay the folder structure for each of the levels at which you need customization on the feed and add your JSP for feed rendition.

Your custom FeedServlet can have any Path you choose to when you are writing your FeedServlet code.

http://<aemServer>:<aemPort>/<your custom Feed Servlet PATH>?orderby=@jcr:content/jcr:created&orderby.index=true&orderby.sort=desc&path=/content/xxx/xxx&type=cq:Page







No comments:

Post a Comment