PreloadTemplates allows users to insert a premade syntax from a list of selectable templates directly within the source editor.


See also: Help:Including additional CSS and JS, Help:Advanced CSS and JS
  • For site-wide use, an administrator can add the line below to the wiki's MediaWiki:ImportJS page.


The script can be used as it is, but it does also support these customizable variables that can be added before the import on Common.js. Common.js will run before MediaWiki:ImportJS.

Using configuration options with FANDOM Open Source Library scripts
The instructions on this page describe how to use configuration options with a script. Here on the FANDOM Open Source Library, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.
Configuration options load too late, don't work
Proper placement of configuration options
// 1. AjaxRC import statement
// 2. AjaxRC configuration option
var ajaxRefresh = 30000;
// 1. AjaxRC configuration option
var ajaxRefresh = 30000;
// 2. AjaxRC import statement
Variable Description Default value Type
preloadTemplates_list Set the page name (namespace included) with the list of templates to be preloaded. MediaWiki:Custom-PreloadTemplates string


preloadTemplates_list = "MediaWiki:Custom-PreloadTemplatesList";
preloadTemplates_subpage Set the name of the subpage that every template will use to store the premade syntax. If the value case-by-case is used, no subpage will be added to the template list which must contain the list of complete paths. preload string


preloadTemplates_subpage = "syntax"; - the code will be preloaded from the /syntax subpage. preloadTemplates_subpage = "case-by-case"; - the template list will include the complete path for each template. No subpage will be added to it.



To use the tool, you have to create the required pages:

  • MediaWiki:Custom-PreloadTemplates (or whatever you set as your template list).
    • You will add here the list of the templates you want to preload from the editor. Everything in a wikitext bulleted list (the list made by *) will be treated as a template name. Everything else will be treated as normal text.
    • You may also add a display title to by using a pipe (|) after the template name, similarly to how the wiki navigation works.
  • For each template you listed, you have to create the subpage preload (or whatever you set as your subpage).
    • Here you will add the text that you want to be preloaded as it is when the template is selected.
    • If you choose to have a case-by-case preload page, then the full path must be used on the template lists. With a case-by-case preload, it's possible to have multiple preload pages for a single template.

Both kind of pages support the use of <noinclude></noinclude> and <includeonly></includeonly> tags.



Using the default configuration if on MediaWiki:Custom-PreloadTemplates we add

Generic templates:
* Template 1 | Template 1 (for characters)
* Template 2
* Template 3

Other templates:
* Template 4
* Template 5
* Template 6

With this code, clicking on any of the template listed there will add the text stored on the subpage, for example Template:Template 1/preload. The template will be listed with the display title indicated after the pipe, if added.


By using these options

preloadTemplates_list = "MediaWiki:Custom-PreloadTemplatesList";
preloadTemplates_subpage = "case-by-case";

the template list will be retrieved from MediaWiki:Custom-PreloadTemplatesList. On that page, using this code

* Character Infobox/preload1 | Character Infobox (ver 1)
* Character Infobox/preload2 | Character Infobox (ver 2)
* Object Infobox/preload | Object Infobox

Will create a list using the display titles after the pipe character which will preload the page indicated before the pipe.

Tags in preload page

On the preload page of a template, if we use

{{Template 1
| parameter A   = 
| parameter B   = 
| parameter C   = 
[[Category:Preload pages]]

When the template will be preloaded only the following code will be added to the editor:

{{Template 1
| parameter A   = 
| parameter B   = 
| parameter C   = 

If you want to preload noinclude/includeonly tags (for example, if you want to add a category), you can do so by using a trick like this:


which will result in


once preloaded.


For some users who have the Rich-Text Editor enabled on their Special:Preferences, this script may not work for them in the main namespace articles. In order to avoid this case, one must choose the "Source editor" as their Preferred editor.


Date Notes Updated by
October 7th, 2016 Created leviathan 89
October 9th, 2016 Added other languages, better skins support leviathan 89
October 15th, 2016 Added other languages leviathan 89
October 17th, 2017 Added display name and case-by-case support leviathan 89
November 8th, 2017 Rewritten the script using I18n-js, other fixes KockaAdmiralac