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
December 4, 2017

No its not happening due to special characters

New Participant
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

New Participant
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

New Participant
December 4, 2017

Hi Harsharya,

I am  facing the exactly same issue. Can you  please guide how you fixed it.

Thanks in advance.

Regards,

Anjali

New Participant
July 28, 2017

Hi.

I am facing one issue. Its showing special characters when view source the feed generated by atom.

http://localhost:4503/content/geometrixx/en/products.feed

or just open the url in chrome.

New Participant
April 12, 2017

Hi,

Please find the feed below.

<feed xmlns="http://www.w3.org/2005/Atom"><id>http://localhost:4503/comp/news0</id><updated>2017-04-11T07:01:19.028Z</updated><title type="html">
                              news
                       </title><generator uri="http://adobe.com/aem" version="6.1.SP1">Adobe Experience Manager</generator><entry><title type="html"> All you need to know about the new £1 coin</title><summary type="html">As the new pound coin enters circulation, find out what makes it ‘the most secure coin in the world’ and hear from the man responsible for getting it out to customers across the UK.</summary><id>http://localhost:4503/comp/news0/test1</id><published>2017-04-11T07:29:10.132Z</published><updated>2017-04-11T07:29:10.132Z</updated></entry><entry><title type="html"> Happy birthday to EU and goodbye - Economics Weekly</title><summary type="html">Sterling is down 12% since the referendum and some effects of its decline are becoming apparent.</summary><id>http://localhost:4503/comp/news0/harsh1</id><published>2017-04-11T07:29:11.688Z</published><updated>2017-04-11T07:29:11.688Z</updated></entry><entry><title type="html"> Happy birthday </title><summary type="html">Sterling is down</summary><id>http://localhost:4503/comp/news0/testing</id><published>2017-04-11T07:29:13.444Z</published><updated>2017-04-11T07:29:13.444Z</updated></entry><entry><title type="html"> All you need to know about the new £1 coin</title><summary type="html">As the new pound coin enters circulation, find out what makes it ‘the most secure coin in the world’ and hear from the man responsible for getting it out to customers across the UK.</summary><id>http://localhost:4503/comp/news0/testing1</id><published>2017-04-11T07:29:22.986Z</published><updated>2017-04-11T07:29:22.986Z</updated></entry><entry><title type="html"> All you need to know about the new £1 coin</title><summary type="html">As the new pound coin enters circulation, find out what makes it ‘the most secure coin in the world’ and hear from the man responsible for getting it out to customers across the UK.</summary><id>http://localhost:4503/comp/news0/testrss</id><published>2017-04-11T07:29:44.388Z</published><updated>2017-04-11T07:29:44.388Z</updated></entry><entry><title type="html"> Happy birthday to EU and goodbye - Economics Weekly</title><summary type="html">Sterling is down 12% since the referendum and some effects of its decline are becoming apparent.</summary><id>http://localhost:4503/comp/news0/testingrss</id><published>2017-04-11T07:29:56.457Z</published><updated>2017-04-11T07:29:56.457Z</updated></entry></feed>
<!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/comp_com/en_uk/comp/news0.rss on this server</p>
        
        
        
        <hr>
        <address>ApacheSling/2.4 (jetty/9.2.9.v20150224, Java HotSpot(TM) 64-Bit Server VM 1.8.0_102, Linux 2.6.32-358.18.1.el6.x86_64 amd64)</address>
    </body>
</html>

MC_Stuff
New Participant
April 12, 2017

Hi Harsharya,

Response is not valid xml. Can you attach the response of feed?

Thanks,

New Participant
April 11, 2017

Sham HC wrote...

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

 

I am facing one weired issue my feeds are working fine in author environment. But when i pushed the code to publish i am getting error "Cannot have a DOCTYPE declaration outside of prolog" Can someone please help me.

New Participant
April 11, 2017

I am facing one weired issue my feeds are working fine in author environment. But when i pushed the code to publish i am getting error "Cannot have a DOCTYPE declaration outside of prolog" Can someone please help me.

smacdonald2008
New Participant
October 16, 2015

Have you followed the documentation specified here: http://dev.day.com/docs/en/cq/current/wcm/web_syndication_feeds.html ?