Open main menu

Extension:FilePageMasking

MediaWiki extensions manual
OOjs UI icon advanced.svg
FilePageMasking
Release status: stable
Implementation Hook
Description Translates local links to file description pages by masking ".xxx" as "_xxx".
Author(s) Robert Rohde
Latest version 1.0
MediaWiki 1.14+
License No license specified
Download Template:WikimediaDownload/svn
Translate the FilePageMasking extension if it is available at translatewiki.net
Check usage and version matrix.

The FilePageMasking extension makes it easier for web users and search engines to recognize that file description pages contain HTML by changing the extension at the end of the file description page from ".xxx" to "_xxx", i.e. the URL is transparently changed from pointing at File:Foo.jpg to File:Foo_jpg. When a file description page of the form "_CDC" is requested, the extension automatically translates it back to ".xxx" before fetching the page. For backwards compatibility, all ".xxx" links to file description pages will also continue to function normally.

InstallationEdit

Download the source files into your extensions/ directory, then add the following to your LocalSettings.php:

require_once($IP.'/extensions/FilePageMasking/FilePageMasking.php');

ConfigurationEdit

The choice of masking character can be set by adding

$wgFilePageMaskingCharacter = '?';

to LocalSettings.php, where '?' is replaced by the character you wish to use. By default this is set to '_'.

The setting of this variable must be a single character, and must be valid in a URL. Likely alternatives to '_' include '!' or ':'.

This extension relies on $wgFileExtensions to determine the list of case insensitive file extensions to translate. In the default Mediawiki install, with $wgStrictFileExtensions set to true, this will already be configured as a comprehensive list of allowed file extensions, and no further action is needed. On sites where $wgStrictFileExtensions is set to false, the user may upload files with extensions not considered by $wgFileExtensions. If this is the case, those file extensions will not be masked.