Open main menu

Extension:DynamicRedirect

MediaWiki extensions manual
Crystal Clear action run.svg
DynamicRedirect
Release status: beta
Implementation Special page
Description Redirects user to a dynamically determined page
Author(s) Petr Kadlec (Mormegiltalk)
License GPL
Download
Readme file
Translate the DynamicRedirect extension if it is available at translatewiki.net
Check usage and version matrix.

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.

InstallationEdit

  • 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:
    require_once "$IP/extensions/DynamicRedirect/DynamicRedirect.php";
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

UsageEdit

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.

TransclusionEdit

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.