Customizing RSS Feed | Community
Skip to main content
New Participant
October 16, 2015
Solved

Customizing RSS Feed

  • October 16, 2015
  • 13 replies
  • 6079 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

New Participant
October 16, 2015

I am not actually trying to display the feed on my site.  I would like to take the url http://localhost:4502/content/tod.feed.rss.xml and use it with feed burner.  Which the url returns the rss xml that I need.  However, I would like to change the values for the entry items link to a property I have set on the child pages and the pubDate to the lastModified date instead of using the creating date.  I thought I would be able to overwrite the feed.jsp and feedentry.jsp, more so the feedentry with these new values.

I would rather not use a list component to render the feed since I am storing references to other pages in my repository under the tod page.  This group of child pages will essentially be turned into an rss feed but at the same time I want to prevent the rss xml to use the childpages path since those pages will be hidden from the user.

<item>
<link>substitute with termPath property</link>
<comments>...</comments>
<guid>...</guid>
<title>../title>
<description>...</description>
<pubDate>substitute with lastModified date, not creation or publish date</pubDate>
<category />
<author>...</author>
</item>
Ojjis
OjjisAccepted solution
New Participant
October 16, 2015

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

Sham_HC
New Participant
October 16, 2015

Try with [1] which includes jcr:content & it works. To avoid jcr:content in the url create a proxy  example Page.feed.jsp with text from [2].

[1]   http://localhost:4502/content/tod/jcr:content.feed.rss.xml

[2]    /libs/foundation/components/primary/cq/Page/proxy.jsp