Adding RSS Syndicator in Magnolia
by Anurag Shrivastava, Xebia IT Architects
I wanted to display few items from the RSS feed of our blog on our home page. After digging for some information on Magnolia wiki, I found a small article on how it should be done. However, it did not work. Possibly it was written for an old version of Magnolia. After spending some time on fixing the problems to make it work, I decided to write a new RSS Syndicator for Magnolia. It works for Magnolia 3.0 and here is how:
Step 1: Get RSS Utilities from Sun.
This taglib simplifies integrating RSS feeds into JSPs. First download the RSS utilities. You can also read a tutorial on RSS utils.
Step 2: Unzip and copy the files
Unzip downloaded rss_utils.zip file.
Copy rssutils.jar to C:\Apache\apache-tomcat-5.5.20\webapps\magnoliaAuthor\WEB-INF\lib
Copy rssutils.tld to C:\Apache\apache-tomcat-5.5.20\webapps\magnoliaAuthor\WEB-INF
Step 3: Modify web.xml file
Modify:
C:\Apache\apache-tomcat-5.5.20\webapps\magnoliaAuthor\WEB-INF\web.xml
I added the highlighted lines in the web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http:
xmlns:xsi="http:
xsi:schemaLocation="http: http: <description>Magnolia</description>
__<jsp-config>
<taglib>
<taglib-uri>rssutils</taglib-uri>
<taglib-location>/WEB-INF/rssutils.tld</taglib-location>
</taglib>
__
<display-name>magnolia</display-name>
The above modification makes sure that Magnolia web application recognizes the new RSS taglib.
Step 4: Copy rssFeeder.jsp
Copy rssFeeder.jsp to C:\Apache\apache-tomcat-5.5.20\webapps\magnoliaAuthor\templates\jsp\custom
This jsp reads RSS feed URL and no of items from the Magnolia repository and presents information on webpage.
Step 5: Import dialog and paragraph
Import dialog and paragraph definitions in Magnolia repository by logging in as Magnolia superuser.
First go to Configuration->Dialogs menu. Select node samples and click right mouse button. You will see the import from XML in a menu. Import file dialog_rss.xml here.
If import has gone well you will see a new dialog called RssDialog in your repository browser. This dialog holds the configuration parameters like RSS Feed URL and Item count for Rss Syndicator.
Now select Paragraphs and import paragraph_rss.xml under the samples.
ADD:
If the import doesn't work, like I did in my case (Magnolia 3.0.2) add the nodes by yourself.
The RSSDialog simply needs two Controls of the type "edit" with the names: url (inputfield for the RSSFeed-Url) und items(number of shown items).
And you need to define a normal paragraph with the name "RssFeeder".
The reason why the import didn't work was that the files in the attachment must have been an export of an older version of magnolia, with an different XML-Syntax for the description auf the node-data like it is in Magnolia 3.0.2
Step 6: Add Rss Syndicator in the Right Column
I wanted to add RSS syndication in the right column of my two column layout. For this purpose, I changed the file sample-twocolumns.jsp in the directory C:\Apache\apache-tomcat-5.5.20\webapps\magnoliaAuthor\templates\samples\templates
<cms:adminOnly>
<div style="clear:both;">
<cms:newBar contentNodeCollectionName="rightColumnParagraphs" paragraph="samplesRightColumn*,RssFeeder*" />
</div>
</cms:adminOnly>
My change is highlighted. Make sure you do not leave a space after comma or else Magnolia will not recognize the new paragraph.
Step 7: Use RSS Syndicator
Now go to the page where you want to show the RSS feeds. Click New and select RSS Newsfeed. You will see a dialog where you can enter RSS feed URL and no. of items to show. Once this has been done successfully, you can see the RSS items on your Magnolia webpage.
This is a nice way to create RSS feeder paragraph when we just want to list the titles and
link them in paragraph. But when we want to extract some more information or tries to access
tags which are not standard like the dc-author tag used by wordpress for specifying auhthor
of blog , its not possible with RSS utils. RSS feeder is also a xml so we can make use of jsp
standard tag library to process the feed. I am working on that , will post it soon.