From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type Tag, Hook, MyWiki
DescriptionTemplate:Extension#description Allows to include a custom excerpt of recentchanges to be included on a wiki page, or to be published as an RSS or Atom feed.
Author(s)Template:Extension#username Daniel Kinzler (Duesentriebtalk)
MediaWikiTemplate:Extension#mediawiki 1.23+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
  • $wgNewsFeedURLPattern
  • $wgNewsFeedUserPattern

  • <news>
  • <newsfeed>
  • <newsfeedlink>
Hooks usedTemplate:Extension#hook

Translate the News extension if it is available at translatewiki.net

Check usage and version matrix.

The News extension allows a custom excerpt from Special:Recentchanges to be included on a wiki page, or to be published as an RSS or Atom feed. It supports several types of filtering as well as full custom formatting of entries, using template syntax.

Note that the functionality of this extension overlaps with the DynamicPageList and DynamicPageList2 extensions - however, this extension has a different focus.


The extension can be retrieved directly from Git [?]:

  • Browse code
  • Some extensions have tags for stable releases.
  • Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).

Extract the snapshot and place it in the extensions/News/ directory of your MediaWiki installation.

If you are familiar with git and have shell access to your server, you can also obtain the extension as follows:

cd extensions/
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/News.git


  • Download and place the file(s) in a directory called News in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/News/News.php";
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


this includes a list of recent changes on the wiki page
this defines a news feed of recent changes; on the wiki page, a preview is rendered, similar to the output of the <news> tag; The page then supports RSS and Atom feeds, see #Accessing Feeds below.
this creates a link to a news feed defined using a <newsfeed> tag. This is convenient for creating prominent links to the news feeds.

Filtering and formatting[edit]

To get the last 10 changes to your wiki on any wiki page, use the following:


You can provide options to control the listing (for example, 20 entries and no minor edits):

 <news limit="20" nominor/>

To define your own format for the generated list, you can provide a pattern that will be used for each entry:

 <news limit="20" nominor>
 * [[{{{pagename}}}]] ([[User:{{{user}}}]], {{{timeanddate}}})

For a full list of options and template parameters, see #Options below.

The <newsfeed> tag supports the same options for filtering and formatting as the <news> tag. For information on how to access a feed defined using <newsfeed>, see the section #Accessing Feeds below.


The following options (tag attributes) can be used to control the output of the <news> tags:

show only the most recent change to each page
the maximum number of entries to show
limit results to the given categories. Multiple categories can be given separated by "|"; Intersections of categories are not supported. Recursion into subcategories is not supported.
limit results to the given namespaces. Multiple namespaces can be given separated by "|"; you can use "0", "-" or "main" to refer to the default namespace.
ignore all "talk" namespaces. Not used if the namespaces option is given.
hide minor edits ("true" or "false", default is "false"). *
hide bot edits ("true" or "false", default is "false"). *
hide anonymous edits ("true" or "false", default is "false"). *
show only patrolled edits ("true" or "false", default is "false"). *
show only page creations ("true" or "false", default is "false"). *
show only edits with the given trigger in the edit comment. Used primarily to explicitly "publish" pages to a news box or feed. If used, the resulting feed will also look slightly different, focusing less on a single edit and more on the page. Most importantly, the edit comment will not be show in the feed, and a generic link to the page will be used, instead of a permalink to a specific version (unless the permalink option is also set).
force the use of permalinks in feeds, even if a trigger is used to publish pages. Per default, feeds that use a trigger use generic page links instead of permalinks to specific versions. Feeds not using a trigger always use permalinks.
wikitext to be inserted before the wikitext generated from the template text is parsed. Can be used to make tables from news.
wikitext to be inserted after the wikitext generated from the template text is parsed. Can be used to make tables from news.
silent (for <newsfeed> only)
generate no inline output, only attach RSS/Atom feeds to the page (since rev:25798, 2007-09-11).

* if some edits are filtered out, the edit shown by in the news list may not refer to the current revision. To avoid people clicking the link and seeing a later, possible undesirable version, use {{{permalink}}} in your custom pattern to link to the exact revision. See the "parameters" section below.


When giving a template text between the <news> tags, the following template-parameters are available (use them as {{{xxx}}}):

raw timestamp - can be formatted using the parser function "time", e.g. {{#time:j. M.|{{{rawtime}}}}}
date of the edit, formatted per user preference
time of the edit, formatted per user preference
time and date of the edit, formatted per user preference
numeric namespace id, can be used with {{ns:{{{namespace}}}}}
canonical title (without namespace prefix)
full title, with namespace prefix
numerical change type (0 = edit, 1 = new, 2 = move, 3 = log, 4 = move-over)
"true" for minor changes, blank otherwise
user name who made the entry
edit summary (escaped wikitext, safe to use)
revision id associated with this entry (or zero)
revision id associated with the entry before this one (or zero)
full diff link for the edit (or blank)
full URL to the revision created by the edit (may not be the current revision)
"true" for bot edits, blank otherwise
"true" for newly created pages, blank otherwise
"true" if the edit was patrolled, blank otherwise
page length before the edit
page length after the edit
the full content of the page
the page's content up to about 2KB of text, with smart cut-off.

Accessing Feeds[edit]

If the page Foo defines a feed using a <newsfeed> tag, that feed can be referenced by using feed=rss or feed=atom in the URL respectively.

So, if the URL path for page Foo is /wiki/Foo, you can use


to get an RSS feed for that page. If the URL is /w/index.php?title=Foo, you would use


You can conveniently create links to feeds using the <newsfeedlink> tag: For example,

 <newsfeedlink feed="Foo" format="rss">My Foo Feed</newsfeedlink>

would generate a link to the news feed defined on page Foo using a <newsfeed> tag.

You can also specify an icon to use in the link:

 <newsfeedlink feed="Foo" format="rss" icon="rss.png">My Foo Feed</newsfeedlink>

would generate a link that has the image "rss.png" before the link text (the icon option refers to the name of an image uploaded to the wiki).

 <newsfeedlink feed="Foo" format="rss" icon="rss.png|right">My Foo Feed</newsfeedlink>

would generate a link that has the image to the right of the link text; and

 <newsfeedlink feed="Foo" format="rss" icon="rss.png" title="RSS feed"/>

generates a link that only shows the given icon. The title attribute specifies the tooltip to show when the mouse hovers over the link.

Note that the link text may contain full wiki text, and the title-attribute may contain variables like News.


Configuration settings to define in LocalSettings.php

this defines the pattern used by the <newsfeedlink> tag to generate feed URLs. In the pattern, $1 will be replaced by the page title, and $2 will be replaced by the requested feed format. If you are using pretty URLs with $wgArticlePath set to $wgScript/$1 or /wiki/$1, etc., you can use the following for nicer feed URLs:
$wgNewsFeedURLPattern = $wgArticlePath . '?feed=$2';
(note that $wgArticlePath already contains $1 withe the meaning "page title") If you want to use rewrite rules for canonical feed URLs, like /feed/Foo.rss, set
$wgNewsFeedURLPattern = '/feed/$1.$2';
this defines the pattern used to generate author names in feed items. In the pattern, $1 is replaced by the user name. To e.g. generate email-addresses at your site as author names, use
$wgNewsFeedUserPattern = '$1@' . $wgServerName;

Note that the News extension relies on the recentchanges table. MediaWiki automatically purges entries from that table after some time (seven days, per default), so older changes will not be shown by the News extension either. To increase the time for which the change log is kept, set $wgRCMaxAge to the desired number of seconds:

$wgRCMaxAge = 60 * 24 * 3600; //60 days


  • rev:21283: adding support for RSS/Atom feeds; experimental
  • rev:21478: use different way to hook feed output, to deal with erroneous '304 Not Modified' responses
  • rev:21842: added publishing-trigger option; made hatom-compliant, forced absolute links, fixed some http issues

Related Extensions[edit]

The Dynamic Page List extension creates reports on pages based on a variety of selection criteria and offers mechanisms for content transclusion. See also Special:MyLanguage/Extension:GoogleNewsSitemap