Extension:IndexFunction

From MediaWiki.org
Jump to: navigation, search

The IndexFunction extension provides a parser function that allows to create automatic redirects and disambiguation pages.

MediaWiki extensions manual
Crystal Clear action run.png
IndexFunction

Release status: beta

Indexexample.png
Implementation Parser function, Special page
Description Parser function to create automatic redirects and disambiguation pages
Author(s) Alex Zaddach (Mr.Z-mantalk)
MediaWiki 1.14.0+
Database changes Yes
License GPL v3
Download
Hooks used
ParserFirstCallInit

LanguageGetMagic
OutputPageParserOutput
LinkEnd
InitializeArticleMaybeRedirect
SearchGetNearMatch
ArticleDeleteComplete
ArticleInsertComplete
EditPage::showEditForm:initial
SpecialMovepageAfterMove
LoadExtensionSchemaUpdates
BeforePageDisplay
ParserTestTables

Translate the IndexFunction extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Usage[edit | edit source]

To use the extension, tag pages with {{#index:Index1|Index1|...}}, where "Index1," "Index1", etc. are the titles you wish to index the current page as. (Think of the index in a book, which may contain For X see Y). This will cause Index1 and Index1 to automatically redirect to the page from links and searches. Multiple pages can share the same indexes, instead of redirecting to the page, the titles will redirect to an automatically generated disambiguation page. The page will sort the articles into headings based on the categories that the pages are in.

Titles used as indexes have a couple restrictions - they cannot also exist as pages (if a page is created at the same title as an index, the index will be deleted from the database) and they must be valid page titles.

The appearance of internal links to index titles can be customized using CSS, all links will contain the "mw-index" class.

Installation[edit | edit source]

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

Configuration parameters[edit | edit source]

There is one configuration variable and one message that should be configured per-site.

  • $wgSpecialIndexContext: Used to set the context given on Special:Index auto-disambig pages, can be 1 of 2 options:
    • 'extract' (default) - Show an extract from the start of the article
    • 'categories' - Show a comma-separated list of categories the article is in
  • MediaWiki:index-exclude-categories is used by the automatic disambiguation page to filter out certain categories that should not be used to sort articles, such as maintenance categories and other categories not related to the subject. The format of the page is to put each category on a line, without the category prefix, i.e.
Pages needing cleanup
Pages needing proofreading