Feed Module


The Feed module can import RSS or Atom feeds from (almost) any web location and display them in a customizable way. It can also combine feeds from multiple sources.


attribute required allowed values default description
src yes single URL address or semicolon-separated list of URL addresses none points to the location of source RSS or Atom feed(s)
limit no any reasonable number none limits the number of news items
offset no any reasonable number 0 which item number to start from

Display format

If no format is specified all the news items are displayed using the default format. To specify a custom format one should use module invocation:

[[module Feed src="somesource"]]
<custom format>

where the inner <custom format> element is any block of text following the wiki-syntax, where special variables can be used:

variable aliases description
%%title%% title of the news item
%%linked_title%% %%title_linked%% title of the news item linking to the original web page
%%channel_title%% title of the news channel (useful when combining multiple feed sources)
%%linked_channel_title%% %%channel_title_linked%% title of the channel linking to the feed source page
%%link%% URL address to the original news item
%%description%% %%short%%, %%summary%% short summary of the item
%%content%% %%long%%, %%body%% full content of the item (only when available; falls back to description if not)
%%date%% date of the item publication
%%date|format%% prints date with a custom format. Most tokens from php's strftime are accepted. You may find the howto contributed by community useful.
%%custom%% gives access to any field in the feed (see below)

The default format is:

++ %%linked_title%%



How to use %%custom%%

To access any field in the feed environment, use

%%custom <pointer>%%

where pointer is a path to the requested element. It is easier to learn this by example:

Look at fragment of an item from Digg:

    <title>UFO gathering draws believers and belittlers</title>
        The 37th annual Mutual UFO Network symposium is being held this weekend in Denver, 
        attracting throngs of believers and the downright curious — as well as upright skeptics 
        and debunkers.  
    <pubDate>Sat, 15 Jul 2006 15:32:45 GMT</pubDate>
    <guid isPermaLink="true">

To access the <digg:diggCount> and display it use:

digg counts: %%custom digg:diggCount%%

To access a nested element <digg:username> use:

submitted by %%custom digg:submitter/digg:username%%

Now to access any element starting from the root feed element: look at the fragment of the digg feed code again:

<rss version="2.0">

To access the channel tittle element use:
%%custom feed/channel/title%%

It is important to start with the feed word. Ater that the full path to the element follows.

You can also use %%custom%% inside [[image ...]] and some other places. In some cases however a space character must be replaced with an underscore not to confuse the parser, e.g. to display user submitter image from the digg feed you can use:

[[image %%custom_digg:submitter_userimage%%]]


Combine Slashdot and Digg technology feeds

URL for the feeds are:

Simply do:

[[module Feed src="http://rss.slashdot.org/Slashdot/slashdot;http://digg.com/rss/containertechnology.xml"]]

More advanced example:

[[module Feed src="http://rss.slashdot.org/Slashdot/slashdot;http://digg.com/rss/containertechnology.xml" limit="20"]]
++ %%linked_title%% (%%linked_channel_title%%)

%%date%%, submitted by %%custom digg:submitter_username%% %%custom dc:creator%%


[[module Feed src="http://rss.slashdot.org/Slashdot/slashdot;http://digg.com/rss/containertechnology.xml" offset="20" limit="20"]]
**%%linked_title%%** (%%linked_channel_title%%, %%date%% by %%custom digg:submitter_username%% %%custom dc:creator%%)

which displays first 20 items in detail and next 20 items just printing the title, channel title, date and submitter.

BTW: a very nice digg feed import is presented at our snippets code repository here.