Extension:RecentPages



The RecentPages extension adds a list of recently added pages to the current page. It can also do random pages. If used in conjunction with CustomNavBlocks can be used to add a side-panel of recent additions to the wiki. The  option will pull back recent pages from all the namespaces specified in $wgContentNamespaces. Pages that are redirects will be excluded.

Note that the only options you have for the random pages are mainspace and all content namespaces. There are technical reasons for that having to do with how RandomPage is set up. Basically, it defaults to the content namespaces, and there's probably some way to override that, but I got tired of fooling with it. A makeshift solution is just to pull everything and then filter it, but that gets pretty expensive if you're dealing with a small subset of the content pages, and it doesn't work at all if it's not a subset of the content pages (e.g. the User space is generally not a content namespace). However, mainspace is usually a pretty big subset of the content namespaces, so I left that as an option.

$wgRecentPagesDefaultMinimumLength
Minimum page length of a randomly-selected article

$wgRecentPagesDefaultLimit
Default number of articles to pull back

$wgRecentPagesMaxAttempts
Maximum number of attempts to get a unique random article

$wgRecentPagesDisableOtherNamespaces
Due to a glitch, leave this set to true; it has something to do with selecting random pages. It's probably some feature that doesn't work yet.

$wgRecentPagesDefaultSort
Shall we sort by default?

Examples
Pull back six most recent normal pages: Pull back ten most recent pages from user namespace:

Pull back six most recent pages in content namespaces:

Pull back six most recent pages regardless of namespace:

Pull back six most recent pages regardless of namespace and display in double-column format:

Pull back six most recent pages regardless of namespace and display in double-column format:

Pull back twelve random pages from mainspace that have a minimum length of 600 characters:

Pull back twelve random pages from mainspace that have a minimum length of 1,000 characters:

Pull back twelve random pages from mainspace and sort them alphabetically:

Display a maximum of 50 results; display only results that have a short_summary property set; put a space in between the displayed page title and displayed page property value; put the page title in bold italics and display the DISPLAYTITLE rather than the unchanged page_title:

For instructions and examples on how to use the extension with Extension:BedellPenDragon to generate results involving page metadata, see also Extension:BedellPenDragon.

Changelog

 * 0.1.1 &mdash; Weed out redirects from results; also add "content" options and "columns" argument
 * 0.1.2 &mdash; Add random tag
 * 0.1.3 &mdash; Add support for displaytitle
 * 0.1.4 &mdash; Add compatibility with BedellPenDragon extension

Code
Place the following code in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

How do I control the order in which pages in the new pages feed show up? I want to move one of them up/down in the sequence, either to draw attention to it, or deflect attention from it, or whatever.
There probably should be an easier way to do this, but currently all you can do is, to bring something to the top, delete the page and the undelete it. If you want to bury something, you have to create a bunch of new articles.

Sometimes new pages are spammy or otherwise not up to quality standards. How do I make it so that it skips the first few newest pages?
It would be easy to add a parameter to make it do this, but I haven't done it yet.

No pages are showing up
Is $wgRecentPagesDefaultMinimumLength set so high that it's excluding all the pages?

It doesn't work when I use
This is a glitch; work around it by leaving out the namespace. It defaults to main.