Extension:NamespacePreload

MediaWiki extensions manual
OOjs UI icon advanced.svg
NamespacePreload
Release status: stable
Implementation Page action
Description Preloads templates on new pages based on their namespace
Author(s) Ostrzycieltalk
Latest version 1.1.0
Compatibility policy master
MediaWiki 1.30+ (I think)
PHP 7.0+
Database changes No
License GNU General Public License 2.0 or later
Download
Translate the NamespacePreload extension if it is available at translatewiki.net
Check usage and version matrix.

The NamespacePreload extension lets you define text that should be preloaded on new pages in a certain namespace. This can be useful if you want to enforce some categorization style, or make all pages in a namespace use a certain template.

Pre-save transforms can be optionally applied before showing the edit page to the user. See: Configuration.

InstallationEdit

  • Download and place the file(s) in a directory called NamespacePreload in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'NamespacePreload' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

ConfigurationEdit

$wgNamespacePreloadDoPreSaveTransform
Whether to apply pre-save transforms to the preloaded text before showing the edit page to the user. Default is false.

UsageEdit

To define text that should be preloaded for a namespace first you have to determine the namespace ID. Please refer to the MediaWiki docs on how to do this. Once you obtain your namespace ID simply create a page by the following name: MediaWiki:Preload-namespace-<namespace ID>. For example, if you want to define a preload for the main namespace (ID 0), you should save it to this page: MediaWiki:Preload-namespace-0.

The contents of a message defined in this way is then parsed before being shown to the user, so all templates will be expanded. Basically, it behaves like a standard preloaded template.