Customizing RSS Feed | Community
Skip to main content
Level 2
October 16, 2015
Solved

Customizing RSS Feed

  • October 16, 2015
  • 13 replies
  • 6081 views

I have children pages that I would like to display in rss xml using page.feed.rss.xml.  I placed the /feed.jsp and /feedentry.jsp from /libs/foundation/component/page into my /apps/[project]/component/page and to change the defined atom:link and atom:publish.  However, the rss feed is not picking up the change.  It does not appear to be pointing to the feed jsp under /libs/foundation/components/page which the sling resource resolver for /page.feed shows /libs/sling/servlet/default/feed.jsp.  I have even tried creating feed.rss.xml.jsp in my project page component with no success.

Also the sling servlet resolver referenced com.day.cq.commons.servlets.FeedRendererServlet and I wondering if the returned atom xml goes through this render to get the resulting xml page.feed.rss.xml.  If that is the case, I would I go about making changes to the atom:publish and atom:link.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ojjis

I was doing a similar thing.
It is possible to override  the "foundation/components/primary/cq/Page/feed.jsp" to control you own way of what should be included in the feed from the page that you "start from", in you case "/content/tod.feed.rss.xml". There you can then make you own iterator to further specify which pages under the root page that should be listed. If you don't want any pages at all or just properties from the page itself you can implement that there as well. 

I might have missed something but if there are only things under the jcr:content it would be quite easy to just extract them from the page you are iterating over in your new overlay of the feed.jsp.
Either you overlay the feedentry.jsp as well and then you can change what goes into all the different elements such as:
 

<atom:entry id="<%= myCustomUrl %>" updated="<%= myCustomDate1 %>" published="<%= myCustomDate2 %>" > <atom:title><%= myCustomTitle %></atom:title> <atom:link href="<%= myCustomLink %>"/> <atom:content><%= myCustomContent%></atom:content> </atom:entry>


You could also have it in the same file i guess if you don't want to include the feedentry.jsp for the page. But that I guess is entirely up to you.

One heads up for working with these files is that they are VERY sensitive when it comes to line breaks and extra spaces that you are not allowed to have in your jsp files. 
You can read more about this in the KB article here : http://helpx.adobe.com/communique/kb/OutputStreamAlreadyObtained.html

 

Good Luck
/Johan

13 replies

December 4, 2017

Hi Anjali,

if your facing special characters issue in atom. For this you need over ride the existing feed servlet and create own class. It solved my problem. Atomfeed.java class which implements feed interface create your own class which implements feed and write your logic. Hope it helps

Thanks,

Haarsh

December 4, 2017

Hi Harsh,

Just wanted to confirm if the below issue comes due to special characters??

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html>

  <head><title>500 STREAM</title></head>

  <body>

  <h1>STREAM</h1>

  <p>Cannot serve request to /content/test/en/rss/common.feed on this server</p>

  <hr>

  <address></address>

  </body>

</html>

Regards,

Anjali

December 4, 2017

No its not happening due to special characters