Censorship banner.png

Help:RSS

From Wiki - Hipatia
Revision as of 19:19, 20 August 2011 by Argon (talk | contribs) (Configuration settings)
Jump to: navigation, search

Usage

Use one section between <rss>-tags for each feed. The rss element may contain parameters if you provide them as attributes to the rss element:

Parameters in the RSS tag
parameter (optional) comment
template="name" 'name' (default: rss-item) is the name of a page in the MediaWiki template namespace, which is a template which comprises the name of another template and a list of named variables of RSS Feed channel subelements (item), these values then being passed to this other template to finally format the RSS items
templatename="Pagename" or

templatename="Namespace:Pagename"

'Pagename' is the name of a template page which is used in the default template (defining the channel subelements) to finally format the RSS items; the template can be in the template namespace (first example denotes a page or any other namespace (second example uses the full specified form)
max="n" show at most n channel subelements (items)
highlight="term1 term2 ..." highlight terms in different colours
filter="term1 term2 ..." show only RSS items with at least one of the terms
filterout="term1 term2 ..." do not show any RSS item containing any of these terms
reverse display the RSS items in reverse order

This extension supports filtering-out (i.e. grep -v) items based on title when in short list mode.

Templates for channel subelements and styling the RSS Feed

If a template is not specified, then the one in MediaWiki:Rss-item is used and determines which RSS feed channel subelements (items) are used.

The selected items are passed to another template Template:RSSPost which determines how the RSS Feed is rendered on the wiki pages. It iterates over each <item> of the RSS feed and substitutes the value of each element found there, e.g. <title>, <link>, <date>, <author>, etc.

Example

The following code renders the 5 recent items of the wikimedia blog feed on the present page and highlights some terms. The layout depends on the content of feed template Template:RSSPost and also of the item template MediaWiki:Rss-item as mentioned above:
<rss max=5 highlight="wiki foundation public donation research community">http://blog.wikimedia.org/feed/</rss>

Configuration settings

parameter default comment
$wgRSSCacheAge 3600 (one hour) Store entries in memcached for this many seconds
$wgRSSCacheCompare false Check cached content, if available, against remote. $wgRSSCacheCompare should be set to false or a timeout in seconds which is less than $wgRSSCacheAge after which a comparison will be made.
$wgRSSFetchTimeout 5 read timeout in seconds
$wgRSSUserAgent 'MediaWikiRSS/0.01 (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension' User-Agent to use for fetching feeds
$wgRSSNamespaces null Ignore the RSS tag in all but the namespaces listed here

null means the <rss> tag can be used anywhere

$wgRSSAllowedFeeds array() URL whitelist of RSS Feeds: if there are items in the array, and the used URL isn't in the array, it will not be allowed
$wgRSSProxy false Optional proxy server to be used for fetching feeds

false: no proxy used