Extension:RSS
RSS État de la version : stable |
|
---|---|
Implémentation | Balise |
Description | Afficher les fils RSS sur une page wiki |
Auteur(s) | K. Elliott-McCrea, mutante, D. Kinzler, Rdb, Mafs, Alxndr, T. Gries, C. Reigrut, K001, J. De Dauw, J. Phoenix, M.A. Hershberger |
Dernière version | 2.25.1 (2017-04-21) |
MediaWiki | 1.23+ |
PHP | 5.4+ |
Licence | Licence publique générale GNU v2.0 ou supérieur |
Téléchargement | README RELEASE-NOTES |
Exemple | https://spookyverse.de/wiki/Vorlage:TV-Termine and https://spookyverse.de/wiki/Vorlage:RSS_News (see main the wikis' mains page where the rss feeds are displayed) |
|
|
Téléchargements trimestriels | 58 (Ranked 77th) |
Utilisé par les wikis publics | 1,691 (Ranked 202nd) |
Traduire l’extension RSS sur translatewiki.net si elle y est disponible | |
Problèmes | Tâches ouvertes · Signaler un bogue |
L’extension RSS effectue le rendu (affiche) un ou plusieurs flux RSS sur une page wiki dans un format standard ou défini par l'utilisateur.
Installation
- Téléchargez et placez le(s) fichier(s) dans un répertoire appelé
RSS
dans votre dossierextensions/
.
Les développeurs et les contributeurs au code doivent à la place installer l'extension à partir de Git en utilisant:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/RSS - Ajoutez le code suivant à la fin de votre fichier LocalSettings.php :
wfLoadExtension( 'RSS' );
- Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.
Utilisation
Utiliser une section entre les balises <rss>
pour chacun des flux.
L'élément rss peut contenir des paramètres si vous les lui fournissez en tant qu'attributs :
attributs optionnels de la balise | commentaire |
---|---|
template="name"
|
'name' (default: rss-item) is the name of a page in the MediaWiki template namespace (default: MediaWiki:Rss-item), which comprises the name of another template (default: MediaWiki:Rss-feed since version 1.90; Template:RSSPost before version 1.90) 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.
Note that when a template is specified here, the extension doesn't pass to it the name of a - default - formatting template. The template specified here needs to take care of that by hard-coding the name of the other template. I.e the default template process is completely aborted. |
templatename="Pagename" or
|
'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 term s
|
filterout="term1 term2 ..."
|
do not show any RSS item containing any of these terms |
reverse
|
display the RSS items in reverse order (since Version 2.25 seems to be a bug regarding the reverse sorting which may be worked around like this:
in \extensions\RSS\RSSParser.php edit line 62:
|
date="(Y-m-d H:i:s)"
|
date format string[1] (since r111347) |
item-max-length="1000"
|
limits the number of character in item descriptions (since r111350) This is not correctly working in v2.18 see tâche T32377. |
Tracking category
All pages in a wiki which use the RSS extension are automatically added to the RSS tracking Category:Pages_with_RSS_feeds.
Templates for channel subelements and styling the RSS Feed
The RSS extension renders feeds on wiki page by using two templates in the MediaWiki system namespace, which can be changed, or which wiki admins can redirected to user-editable namespaces. The mechanism is perhaps not easy to understand, but after its installation, the extension starts with a useful set of templates; a manual set-up is not required.
If a template is not specified, then the one in MediaWiki:Rss-item is used and determines only which RSS feed channel subelements (items) are used. The other template MediaWiki:Rss-feed determines how the complete feed is shown on wiki pages i.e. how and which channel items are shown are listed.
This is the template MediaWiki:Rss-item (since version 1.90) which determines which item elements are used[2]
{{ MediaWiki:Rss-feed \ | title = {{{title}}} \ | link = {{{link}}} \ | date = {{{date}}} \ | author = {{{author}}} \ | description = {{{description}}} }}
The selected items are passed to the other template MediaWiki:Rss-feed (since version 1.90)[2] 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.
Basic MediaWiki:Rss-feed template:
; '''<span class='plainlinks'>[{{{link}}} {{{title}}}]</span>'''
: {{{description}}}
: {{{author}}} {{{date}}}<!-- don't use newline here -->
An alternative improved MediaWiki:Rss-feed template requires the Extension:ParserFunctions:
<!-- The second is an improved version which requires Extension:ParserFunctions --> \
; '''<span class='plainlinks'>[{{{link}}} {{{title}}}]</span>''' \
{{#if: {{{description|}}} \
|: {{{description}}}}}{{#if: {{{author|}}} \
| {{#if: {{{date|}}} |: — {{{author}}} {{{date}}}}} \
| {{#if: {{{author|}}}|: — {{{author}}}}} {{#if: {{{date|}}}|:{{{date}}}}}|}}<!-- don't use newline here -->
Example
The following code renders the four recent items of the wikimedia blog feed on the present page and highlights some terms. The layout depends on the content of feed template MediaWiki:Rss-feed and also of the item template MediaWiki:Rss-item as mentioned above:
<rss max=4 highlight="community wiki foundation">https://wikimediafoundation.org/news/feed/</rss>
- Ahead of UN General Assembly, Wikipedia nonprofit calls on governments to ensure the future internet is shaped by communities for the public interest
- 21 September 2024, New York USA ― As UN Member States are gathering in New York for the 79th United Nations General Assembly, the Wikimedia Foundation, the nonprofit that hosts Wikipedia and othe...
- Wikimedia Foundation 2024-09-21 19:30:00
- Wikimania 2024 in Poland celebrates global volunteers who make Wikipedia and sister projects possible
- The nineteenth edition of the global event will take place in Katowice, Poland (the 2024 European City of Science), from 7 - 10 August.
The post <a href="https://wikimediafoundation.org/news/2024/07... - Wikimedia Foundation 2024-07-31 08:00:00
- Wikimedia Foundation calls on US Supreme Court to strike laws that threaten Wikipedia
- The Foundation supports challenges to laws in Texas and Florida that jeopardize Wikipedia's community-led governance model and the right to freedom of expression.
The post <a href="https://wikimedia... - Wikimedia Foundation 2024-07-25 19:53:00
- Wikimedia Foundation’s Accreditation to World Intellectual Property Organization Blocked for a Fourth Time by China
- Yesterday, the Wikimedia Foundation, the nonprofit that hosts and supports Wikipedia and other Wikimedia projects, was again denied accreditation as a permanent observer to the World Intellectual P...
- Wikimedia Foundation 2024-07-11 17:46:40
Paramètres de configuration
Ajoutez à votre LocalSettings.php l'un des paramètres suivants que vous souhaitez personnaliser.
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
|
15 | read timeout in seconds |
$wgRSSUserAgent
|
'MediaWikiRSS/<Version> (+https://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
|
$wgRSSUrlWhitelist
|
array() (deny any URL = no whitelisted URLs) | URL whitelist of RSS Feeds, the whitelist is empty by default and no URLs are allowed. If there are items in the array, and the used feed URL isn't in the array, it will not be allowed. Use array( "*" ) if you as admin want to allow anyone to use any feed Url. In case your whitelist entries are ignored, please use square brackets for the array instead, e.g. $wgRSSUrlWhitelist = [ 'URL1', 'URL2', 'URL3', ]; |
$wgRSSUrlNumberOfAllowedRedirects
|
0 (no redirects are allowed) | Maximum number of redirects to follow (defaults to 0). This should only be used when the target URLs are trusted to avoid attacks on intranet services accessible by HTTP. |
$wgRSSProxy
|
false | Optional proxy server url and port number to be used for fetching feeds. false: no proxy used |
$wgRSSDateDefaultFormat
|
"Y-m-d H:i:s" | default date format[1] for RSS publication dates |
$wgRSSItemMaxLength (deactivated in version 2.12 r113297; will be activated later.)[3] |
200 | default maximum length of item descriptions (since r111350) |
$wgRSSAllowLinkTag
|
false | to allow active links in feed items |
$wgRSSAllowImageTag
|
false | If you allow to see images in feed items. Do not confuse this parameter with $wgAllowImageTag of MediaWiki core, Display of images causes privacy problems, because the image is fetched in the browser context, so the (image-) server log will contain data of the requesting browser, see the discussion here. Note that since 2013 due to the MediaWiki sanitizer, image tags which have the form <img src="blah"/> are not parsed correctly by the MediaWiki core sanitizer and are not displayed irrespective of this setting (see tâche T48443).
If you want the image to show, set this to true in LocalSettings.php and in \extensions\RSS\RSSParser.php remove this part at lines 485 if ( isset( $wgRSSAllowImageTag ) && $wgRSSAllowImageTag ) {
$extraInclude[] = "img";
} else {
$extraExclude[] = "img";
}
|
Historique technique et attributions
RSS extension is a heavily modified version of the engines RSS by Mafs, RSS by Rdb78, RSS by Duesentrieb, and RSSFeed by Mutante.
Références
- ↑ 1.0 1.1 https://php.net/date
- ↑ 2.0 2.1 2.2 Former versions before 1.90 used the name Template:RSSPost in the template MediaWiki:Rss-item which thus had the default value
{{ RSSPost | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} }}
- ↑ bug30377
Voir aussi
- Category:RSS extensions
- A tool to generate RSS feeds for pages in MediaWiki categories: toollabs:mediawiki-feeds
Cette extension est utilisée par au moins un des projets Wikimédia. Cela signifie probablement que l’extension est assez stable et fonctionnelle pour être utilisée sur des sites à fort trafic. Recherchez le nom de cette extension dans le CommonSettings.php de Wikimédia et dans le fichier de configuration InitialiseSettings.php pour situer les endroits où elle est installée. Une liste complète des extensions installées sur un Wiki donné peut être visualisée sur la page Special:Version de ce wiki. |
Cette extension est incluse dans les fermes de wikis ou les hôtes suivants et / ou les paquets : Cette liste ne fait pas autorité. Certaines fermes de wikis ou hôtes et / ou paquets peuvent contenir cette extension même s'ils ne sont pas listés ici. Vérifiez toujours cela avec votre ferme de wikis ou votre hôte ou votre paquet avant de confirmer. |
- Stable extensions/fr
- Tag extensions/fr
- GPL licensed extensions/fr
- Extensions in Wikimedia version control/fr
- ParserFirstCallInit extensions/fr
- All extensions/fr
- Extensions used on Wikimedia/fr
- Extensions included in BlueSpice/fr
- Extensions included in Miraheze/fr
- Extensions included in MyWikis/fr
- Extensions included in ShoutWiki/fr
- Extensions included in WikiForge/fr
- RSS extensions/fr