Censorship banner.png

Difference between revisions of "Help:RSS"

From Wiki - Hipatia
Jump to: navigation, search
(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…')
 
Line 1: Line 1:
 
==Usage==
 
==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:
+
Use one section between <nowiki><rss></nowiki>-tags for each feed. The rss element may contain parameters if you provide them as attributes to the rss element:
{| class="wikitable"
+
{|
 
|+ Parameters in the RSS tag
 
|+ Parameters in the RSS tag
 
|-
 
|-
Line 8: Line 8:
 
|-
 
|-
 
| <code>template="''name''"</code>
 
| <code>template="''name''"</code>
| '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
+
| '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
 
|-
 
|-
 
| <code>templatename="''Pagename''"</code> or<br/>
 
| <code>templatename="''Pagename''"</code> or<br/>
 
<code>templatename="''Namespace:Pagename''"</code><br/>
 
<code>templatename="''Namespace:Pagename''"</code><br/>
| '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]])
+
| '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)
 
|-
 
|-
 
| <code>max="''n''"</code>
 
| <code>max="''n''"</code>
Line 33: Line 33:
  
 
==Templates for channel subelements and styling the RSS Feed ==
 
==Templates for channel subelements and styling the RSS Feed ==
{{note|The following section and template use will be refactored in the next version 1.9. --[[User:Wikinaut|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.  
 
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) <pre><nowiki>{{ RSSPost | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} }}</nowiki></pre>
 
 
{{note|The template should comprise the description element, too.}}
 
This is the new template, suggested and proposed for implementation in version 1.9+
 
<pre><nowiki>{{ RSSPost | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | description = {{{description}}} }}</nowiki></pre>
 
  
 
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 &lt;item&gt; of the RSS feed and substitutes the [http://cyber.law.harvard.edu/rss/rss.html#hrelementsOfLtitemgt value of each element found there], e.g. &lt;title&gt;, &lt;link&gt;, &lt;date&gt;, &lt;author&gt;, etc.
 
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 &lt;item&gt; of the RSS feed and substitutes the [http://cyber.law.harvard.edu/rss/rss.html#hrelementsOfLtitemgt value of each element found there], e.g. &lt;title&gt;, &lt;link&gt;, &lt;date&gt;, &lt;author&gt;, etc.

Revision as of 10:54, 20 August 2011

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>

<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