Anonymous
Domino 2.0 Rich Internet Applications with IBM Lotus Notes/Domino
You are here: Today » Domino RSS feeds
« Domino 2.0: new template in progress
Domino picture resizer »

Domino RSS feeds

I've made some time to put all the pieces together. The main info for the RSS feed is maintained in the DbConfig document. On each article, an RSS entry is prepared in a computed field. The feed itself is made by a view 'rss' displayed with the '$$ViewTemplate' for rss form.

Feed title and info

This is computed from the fields of the DbConfig document:

nl:=@NewLine;
"<title>"+Subject+"</title>"+nl
+"<link>"+DomainUrl+"/"+Webpath+"/</link>"+nl
+"<description>"+Description+"</description>"+nl

RSS entry for each article

This is based on the fields of the article. But first we have to calculate the date in RSS format:

a:=@Created;
@If(@IsError(@Day(a)); @Return(""); "");

d:=@Right("0"+@Text(@Day(a)); 2);
m:=@Word("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"; " "; @Month(a));
y:=@Text(@Year(a));
tm:=@Right("0"+@Text(@Hour(a)); 2)+":"+@Right("0"+@Text(@Minute(a)); 2);
tz:=@ReplaceSubstring(@TimeZoneToText(@GetCurrentTimeZone; "S"); "GMT":":"; "");

@Implode(d:m:y:tm:tz; " ")

Then the RSS entry is assembled:

nl:=@NewLine;
a:=@DbLookup("":"NoCache"; ""; "lookup"; "dbconfig"; 3);
@If(@IsError(a); @Return(@Text(a)); "");
url:=a+"pub/"+PageKey;
v:="<item>"+nl
+"<pubDate>"+ RssDate +"</pubDate>"
+"<title>"+Subject+"</title>"+nl
+"<description>"+@Implode(Description; " ")+"</description>"+nl
+"<link>"+url+"</link>"+nl
+"<guid>"+url+"</guid>"+nl
+"</item>";
@ReplaceSubstring(v; "&":"&amp;";"&amp;")

Finally

The RSS feed itself is a simple view 'rss' rendered with a $$ViewTemplate in the correct content type:

application/rss+xml

Providing a link on the page is simple. Just compute the database path:

<a href="/<Computed Value>/rss"><img src="/<Computed Value>/rss.png" alt="RSS Feed" style="border:none" /></a>

And you also need this line in the page head to alert the browsers that you have a feed. Here the @formula:

"<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS 2.0\" href=\"/"+@WebDbName+"/rss\">"

Reading RSS

Happy RSS-reading

Download

rss.nsf (384 kB)

Star rating

70%

Comments

To add a comment, log in or register as new user. It's free and safe.