Aus Free Software
Version vom 14. November 2014, 20:03 Uhr von Mati (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png

Release status: stable

Implementation Special page
Description Display a list of pages matching a given prefix together with additional information
Author(s) Mathias Ertl (Mati talk)
Version 2.1.5 (2010-10-27)
MediaWiki 1.13.0 or later
License GPL v3 or any later version.
Download see Download
Parameters $wgSimilarNamedArticlesEnable, $wgSimilarNamedArticlesNamespaces, $wgSimilarNamedArticlesIncludeSubpages, $wgSimilarNamedArticlesAddInfoNamespaces, $wgSimilarNamedArticlesAddInfoCategories, $wgSimilarNamedArticlesAddInfoResources, $wgNamespaceHomes
Example example in this wiki
Hooks used


This extension is somewhat similar to Special:Prefixindex and in fact the algorithm used to find pages is copied from there. The difference is that this special page is able to display additional information such as categories, the namespace and how many resources a page has. The selection of pages displayed can also be finer tuned, either finding all pages in an explicitly given namespace or pages in a predefined set of namespaces. Additionally, you can choose not to display subpages.

This extension was written specially for the VorlesungsWiki and a lot of its functionality geared towards use in that Wiki. It is used to make "general" links to a course that is held by different professors, if only the course (and not who holds it) is relevant.


The source code of this extension is managed on GitHub. You can find the repository at mathiasertl/SimilarNamedArticles. To get the most recent version of this extension, fetch the current HEAD:

git clone SimilarNamedArticles

Older versions are marked as tags, you can view available tags with git tag -l and move back to the current HEAD with git checkout <tag-name>. Versions for older versions of MediaWiki, if available, are managed as branches, use git branch and git checkout <branch> to move to a specific branch. To move back to the newest version, use git checkout master.

Note that GitHub allows you to download older different commits as tarball if you do not want to install git.


The installation is as simple as it could be: Simply download the extension into your extensions-directory, require_once and enable it in LocalSettings.php:

$wgSimilarNamedArticlesEnable = true;

In its default configuration the extension finds, if no explicit prefix is given, all pages with the given prefix in the namespaces defined by $wgNamespacesToBeSearchedDefault (which is, in turn, only the main namespace per default). If you want to explicitly search in the main namespace only, prefix your search with ':'.


The extension is highly configurable. The names of the variables are (hopefully) self-explanatory, an example with a few comments is given here:

# if no explicit prefix is given, search in these namespaces:
$wgSimilarNamedArticlesNamespaces = array( 100 => 1, 102 => 1 );

# do not include subpages in the result:
$wgSimilarNamedArticlesIncludeSubpages = false;

# Usually, the namespaces is not displayed, but you can add it
$wgSimilarNamedArticlesAddInfoNamespaces = true;

# it may be interesting if an article is in certain categories:
$wgSimilarNamedArticlesAddInfoCategories = array('Stub', 'Veraltet');

# if you have enabled PerPageResources for this wiki, it is also 
# possible to display the number of resources for this wiki.
$wgSimilarNamedArticlesAddInfoResources = true;

# if you chose to set  $wgSimilarNamedArticlesAddInfoNamespaces = true,
# you may want to display the namespaces as links to other pages:
$wgNamespaceHomes = array(
       100                     => "Alle LVAs (TU Wien)",
       102                     => "Alle LVAs (Uni Wien)"


Given here are some examples of the usage of this special page. This also servers as a test-suite for this extension. All pages can be found here.

  • Search for articles starting with "Fundamentals". This will only include pages in one of the namespaces defined by $wgSimilarNamedArticlesNamespaces (100, 102) and exclude subpages, since $wgSimilarNamedArticlesIncludeSubpages=false:
  • Search for pages in the TU Wien namespace where the name starts with "Fundamentals":
Special:SimilarNamedArticles/TU Wien:Fundamentals
  • The parameter is always a prefix, the rest of the article-name is discarded. Thats why this search finds more pages than the previous searches:
  • Search for pages in the main namespace where the name starts with "Fundamentals":


  • Compatibility update for PHP 5.3
  • Minimum software requirement is now MediaWiki-1.13.0, because of the MWNamespace class.
  • Special:CreatePage is now in group "VoWi-Extensions" on Special:Specialpages
  • Updated translation to work with all wiki/user language combinations.
  • Updated to work with MediaWiki 1.11.1 and later by fixing LanguageGetSpecialPageAliases (This was a typo in 1.11.0, see Bug 11462)
  • Updated link to this page (This wiki now uses Very short URLs)
  • Subpage-handling is now way better. A page is only classified as subpage if the basepage exists.
  • It is now possible to also display the number of resources by setting $wgSimilarNamedArticlesAddInfoResources to true ($wgResources must also be set to true)
  • complete rewrite with an Algorithm that imitates that used in Special:Prefixindex. The code should be way faster.
  • The extension is now split in two parts:
    • This extension implements the basic functionality
    • SimilarNamedArticlesHeader implements the display of SimilarNamedArticles on top of each page
  • lots of new configuration variables
  • Old version still using the search engine. I'm not aware of where this code can still be found.
  • First version that didn't consider namespaces

See also


GPL v3 or any later version.


The functionality of this extension (and SimilarNamedArticlesHeader) was originally one of the very first hacks that where written for the VorlesungsWiki.


  • Make $wgSimilarNamedArticlesNamespaces a simple array instead of a dictionary
  • we could add http-parameters to allow runtime-modifications of the inclusion of subpages etc. (i.e. ?subpages=true)