Censorship banner.png

Help:RSS

From Wiki - Hipatia
Revision as of 10:51, 20 August 2011 by Argon (talk | contribs) (Created page with '==Usage== Use one section between {{tag|rss|o}}-tags for each feed. The rss element may contain parameters if you provide them as attributes to the rss element: {| class="wikitab…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Usage

Use one section between Template:Tag-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 (default: MediaWiki:Rss-item), which is a template which comprises the name of another template (default: Template:RSSPost) 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 MediaWiki:Rss-item (defining the channel subelements) to finally format the RSS items; the template can be in the template namespace (first example denotes a page Template:Pagename) or any other namespace (second example uses the full specified form Namespace:Pagename)
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

[[#ref_The following section and template use will be refactored in the next version 1.9. --Wikinaut 15:13, 14 August 2011 (UTC)|^]]  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.

This is by default (until extension version 1.8)
{{ RSSPost | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} }}

^  This is the new template, suggested and proposed for implementation in version 1.9+

{{ RSSPost | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | description = {{{description}}} }}

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>

<rss max=5 highlight="wiki foundation public donation research community">http://blog.wikimedia.org/feed/</rss>

Configuration settings

Configuration settings in $IP/extensions/RSS.php
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 (originally proposed in bug 27768)
$wgRSSProxy false Optional proxy server to be used for fetching feeds

false: no proxy used