Extension:DynamicRedirect

MediaWiki extensions manual
DynamicRedirect
Release status: unmaintained
Implementation Special page
Description Redirects user to a dynamically determined page
Author(s) Petr Kadlec (Mormegiltalk)
MediaWiki
License GNU General Public License 2.0 or later
Download
Readme file

The DynamicRedirect extension provides redirection to a dynamically determined page. In the current version, the target can be determined either by evaluating a piece of wikitext, or chosen from a category.

Installation

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

Usage

edit

By going to a URL in the form of

.../Special:DynamicRedirect?mode=mode&target=target

the user is redirected to a page chosen based on the values of the parameters:

  • mode is the primary mode selector, the currently supported values are:
    • parse – parse the expression given in target and use the resulting text as the page title to redirect to
    • catfirst – redirect to the first page in the category which title is in target (without the Category: prefix)
    • catlast – redirect to the last page in the category which title is in target (without the Category: prefix)
  • target – parameter containing either the wikitext, or the category name

If the parameters are not valid, or there is no target page fulfilling the parameters, Special:DynamicRedirect displays a UI (and possibly an error message) showing the available options.

Transclusion

edit

A page dynamically determined per the above criteria (e.g. the last page of a category) can also be transcluded on another page using the straightforward syntax

{{Special:DynamicRedirect | mode = mode | target = target}}

with mode and target same as above.