How To Display Recently Published Pages In MediaWiki?

You can display a list of recently published pages on the homepage or anywhere you want in your MediaWiki website. You can also make random display of pages or use CustomNavBlocks in conjunction to add a side-panel of most recent page additions.

The namespaces specified in $wgContentNamespaces will be pulled back with namespace=”content” option. Redirected pages are automatically excluded.

Configuring Recent Pages Code:

First step you need to make is download extension, then upload and extract its files in  extensions/ directory.

Also make sure all extracted files are located in RecentPages folder in your extensions/ directory, which is present in your website’s root.

Now add the following code in LocalSettings.php file located in your website’s root directory:

require_once "$IP/extensions/RecentPages/RecentPages.php";

Displaying Recent Pages In MediaWiki:

Simply use <recent /> tag to pull back six most recent normal pages.

In the same way you can pull back ten most recent pages from user namespace using:

<recent limit="10" namespace="user" />

For pulling back six most recent pages in content namespaces use:
<recent namespace="content" />

To pull back six most recent pages regardless of namespace use:
<recent namespace="all" />

To pull back six most recent pages regardless of namespace and display them in double-column format use:
<recent columns="2" />

There are many more custom parameters you can browse here to make use of them in your MediaWiki website. Other configuration options allows you to set minimum page length of a randomly-selected article and change default number of articles to pull back.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.