MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: stable
Implementation Page action
Description Preloads templates on new pages based on their namespace
Author(s) Ostrzycieltalk
Latest version 1.2.0
Compatibility policy release branches
MediaWiki 1.30+ (I think)
PHP 7.3+
Database changes No
License GNU General Public License 2.0 or later

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.


  • 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.


Whether to expand templates of the preloaded text. Default is true.
Whether to apply pre-save transforms to the preloaded text before showing the edit page to the user. Default is false.


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.

Template expansionEdit

When $wgNamespacePreloadDoExpansion is set to true (the default value), all templates in the preload message will be expanded before displaying the edit form. You can disable that for all namespaces using this configuration setting.

You can also disable expansion selectively using a trick: let's say your preload message is {{SomeTemplate}}. Create a new template, (let's call it Template:Lbraces) with the following content: {{. Then, in your preload text replace all occurences of {{ with {{Lbraces}}, so instead of {{SomeTemplate}} you would have {{Lbraces}}SomeTemplate}}.