LinkTitles extension for MediaWiki
Automatically add links to existing pages.
 All Classes Files Functions Variables Modules Pages
Configuration

The global configuration variables can be overriden in the local LocalSettings.php file just like with any other extension. More...

Variables

 $wgLinkTitlesPreferShortTitles = false
 Controls precedence of page titles. More...
 
 $wgLinkTitlesMinimumTitleLength = 3
 The minimum number of characters in a title that is required for it to be automatically linked to.
 
 $wgLinkTitlesParseHeadings = false
 Determines whether or not to insert links into headings.
 
 $wgLinkTitlesParseOnEdit = true
 Important configuration variable that determines when the extension will process a page. More...
 
 $wgLinkTitlesParseOnRender = false
 Important configuration variable that determines when the extension will process a page. More...
 
 $wgLinkTitlesSkipTemplates = false
 Determines whether to parse text inside templates. More...
 
 $wgLinkTitlesBlackList = array()
 Blacklist of page titles that should never be linked. More...
 
 $wgLinkTitlesFirstOnly = false
 Determines whether to link only the first occurrence of a page title on a page or all occurrences. More...
 
 $wgLinkTitlesWordStartOnly = true
 Determines whether a page title must occur at the start of a word in order for it to be linked. More...
 
 $wgLinkTitlesWordEndOnly = true
 Determines whether a page title must end with the end of a word in order for it to be linked. More...
 
 $wgLinkTitlesSmartMode = true
 Important setting that controls the extension's smart mode of operation. More...
 
 $wgLinkTitlesCheckRedirect = true
 Determines whether or not to check if a page redirects to the current page. More...
 
 $wgLinkTitlesEnableNoTargetMagicWord = true
 Determines whether or not the magic word NOAUTOLINKTARGET is enabled or not. More...
 
 $wgLinkTitlesTimeLimit = 0.2
 Time limit for online batch processing. More...
 
 $wgGroupPermissions ['sysop']['linktitles-batch'] = true
 Grants the linktitles-batch right to sysops by default. More...
 

Detailed Description

The global configuration variables can be overriden in the local LocalSettings.php file just like with any other extension.

These variables are all defined in LinkTitles.php.

Variable Documentation

$wgGroupPermissions['sysop']['linktitles-batch'] = true

Grants the linktitles-batch right to sysops by default.

Override this only with care. If anybody can execute the special page the server might experience high loads.

Definition at line 221 of file LinkTitles.php.

$wgLinkTitlesBlackList = array()

Blacklist of page titles that should never be linked.

Note
See also: NOAUTOLINKTARGET magic word to allow wiki users to blacklist a page dynamically.

Definition at line 100 of file LinkTitles.php.

$wgLinkTitlesCheckRedirect = true

Determines whether or not to check if a page redirects to the current page.

This check requires that the extension fetches the page content of a potential target page from the database, which costs time.

Note
For maximum performance, set both $wgLinkTitlesCheckRedirect and $wgLinkTitlesEnableNoTargetMagicWord to false in LocalSettings.php. On the developer's machine, fetching the target page content increased the run time from about 50 ms to about 500 ms on a wiki with 90 pages (Intel Core i5-3320M, 2x 2.6 GHz, 16 GB RAM, PHP 5.5.9, Apache 2.4.7, MySQL 5.5.37, MediaWiki 1.23.0). If any of the two mentioned variables is set to true, a page content request will be performed for every page whose title occurs on a given page.

Definition at line 167 of file LinkTitles.php.

$wgLinkTitlesEnableNoTargetMagicWord = true

Determines whether or not the magic word NOAUTOLINKTARGET is enabled or not.

If NOAUTOLINKTARGET is included in a page, this page will never be linked to by the extension. The default is enabled (true), but it comes at the cost of performance.

Note
For maximum performance, set both $wgLinkTitlesCheckRedirect and $wgLinkTitlesEnableNoTargetMagicWord to false in LocalSettings.php. On the developer's machine, fetching the target page content increased the run time from about 50 ms to about 500 ms on a wiki with 90 pages (Intel Core i5-3320M, 2x 2.6 GHz, 16 GB RAM, PHP 5.5.9, Apache 2.4.7, MySQL 5.5.37, MediaWiki 1.23.0). If any of the two mentioned variables is set to true, a page content request will be performed for every page whose title occurs on a given page.

Definition at line 182 of file LinkTitles.php.

$wgLinkTitlesFirstOnly = false

Determines whether to link only the first occurrence of a page title on a page or all occurrences.

Default is false: All occurrences on a page are linked.

Definition at line 106 of file LinkTitles.php.

$wgLinkTitlesParseOnEdit = true

Important configuration variable that determines when the extension will process a page.

If set to true in LocalSettings.php, links will be inserted whenever a page is edited and saved (unless 'minor modifications' is checked). If set to false, the extension will not do anything when a page is edited and saved. Because saving a page automatically invalidates the cache, the next time the page is displayed (i.e., immediately after saving it), the extension might add links if $wgLinkTitlesParseOnRender is set to true.

Definition at line 71 of file LinkTitles.php.

$wgLinkTitlesParseOnRender = false

Important configuration variable that determines when the extension will process a page.

If set to true in LocalSettings.php, links will be added whenever a page is rendered for viewing, after templates have been expanded.

Note
Since pages are cached, links may not appear immediately. When links are added during the rendering process, they do not appear as markup when the page is edited. This may or may not be the behavior that you desire. Also note that if lots of templates or parser functions are included, processing time may increase quite a bit, causing gateway time-out errors of the web server.

Definition at line 84 of file LinkTitles.php.

$wgLinkTitlesPreferShortTitles = false

Controls precedence of page titles.

If true, pages with shorter titles are given preference over pages with longer titles (e.g., link to 'Media' rather than 'MediaWiki'). If false (default), longer titles (which tend to be more specific) are given precedence (e.g., link to 'MediaWiki' rather than 'Media' if both pages exist).

Definition at line 51 of file LinkTitles.php.

$wgLinkTitlesSkipTemplates = false

Determines whether to parse text inside templates.

If this is set to true in LocalSettings.php, the parameters in a template will be parsed (e.g., {{myTemplate|template parameter that may contain a page title}}).

Note
If pages are parsed when they are rendered (see $wgLinkTitlesParseOnRender setting), this setting does not take effect.

Definition at line 94 of file LinkTitles.php.

$wgLinkTitlesSmartMode = true

Important setting that controls the extension's smart mode of operation.

With smart mode turned on (default), the extension will first link all occurrences of a page title on a page in a case-sensitive manner (but see note). It will then perform a second pass in a case-__in__sensitive manner. For example, if you have a page called "IgAN" (abbreviation for IgA nephritis, a kidney disease) and someone writes the alternative form "Igan" in their article, then the page would not be linked if smart mode is turned off.

Note
Because smart mode constitutes two-pass processing of a page, rather than single-pass, the processing time will increase. This may not be noticeable on single page saves, but may play a role during batch processing .

Definition at line 153 of file LinkTitles.php.

$wgLinkTitlesTimeLimit = 0.2

Time limit for online batch processing.

This determines the maximum amount of time in seconds that page processing will take before a refresh of the special page is issued.

Note
See SpecialLinkTitles class.

Definition at line 189 of file LinkTitles.php.

$wgLinkTitlesWordEndOnly = true

Determines whether a page title must end with the end of a word in order for it to be linked.

Example: Given a page 'Media' and an article that contains the word 'MediaWiki', the default setting (true) will prevent the page from being linked, because both words have different endings. If this setting is overriden in LocalSettings.php to be false, a link would be inserted: [[Media]]wiki.

Note
Setting this to false may have undesired effects because there are many short words that may randomly occur in longer words, but are semantically unrelated.
If both $wgLinkTitlesWordStartOnly and $wgLinkTitlesWordEndOnly are overriden to false in LocalSettings.php, you may get weird linking. As a (contrieved) example, consider a wiki that has a page "spa", then the word "namespace" in a technical article would be linked as name[[spa]]ce, which is likely not what you want.

Definition at line 138 of file LinkTitles.php.

$wgLinkTitlesWordStartOnly = true

Determines whether a page title must occur at the start of a word in order for it to be linked.

Example: Given a page 'Media' and an article that contains the word 'Multimedia', the default setting (true) will prevent the page from being linked. If this setting is overriden in LocalSettings.php to be false, a link would be inserted: Multi[[media]].

Note
If both $wgLinkTitlesWordStartOnly and $wgLinkTitlesWordEndOnly are overriden to false in LocalSettings.php, you may get weird linking. As a (contrieved) example, consider a wiki that has a page "spa", then the word "namespace" in a technical article would be linked as name[[spa]]ce, which is likely not what you want.

Definition at line 120 of file LinkTitles.php.