Extension:TemplateSandbox

This is technical documentation of the extension. There is also user documentation.
Category:GPL licensed extensions
MediaWiki extensions manual
TemplateSandbox
Release status: stableCategory:Stable extensions
Implementation Special page Category:Special page extensions, Page action Category:Page action extensions
Description Preview pages using sandboxed templates
Author(s) Brad Jorsch (Anomietalk)
Latest version 1.1.0 (continuous updates)
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.Category:Extensions with release branches compatibility policy
License GNU General Public License 2.0 or later
Download Category:Extensions in Wikimedia version control
Help Help:Extension:TemplateSandbox
  • $wgTemplateSandboxEditNamespaces
Quarterly downloads 24 (Ranked 90th)
Public wikis using 1,040 (Ranked 233rd)
Translate the TemplateSandbox extension if it is available at translatewiki.net
Issues Open tasks · Report a bug
Category:All extensions

The TemplateSandbox extension adds the ability to preview a page using sandboxed versions of templates, allowing for easy testing before making the sandbox code live. It also works with Scribunto modules.

Installation

  • Download and move the extracted TemplateSandbox folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateSandbox
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'TemplateSandbox' );
    
  • Configure as required.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

Parameters
  • $wgTemplateSandboxEditNamespaces - Namespaces in which to show the "Preview page with this template" box below the edit form. NS_TEMPLATE by default. Can be expanded to all namespaces by individual users using advancedtemplatesandbox.js.

Usage

The extension adds a new special page, Special:TemplateSandbox. To preview a page using sandboxed templates, do the following:

  1. Copy the templates to be tested under a common prefix. For example, you might copy Template:Foo to User:Example/sandbox/Template:Foo. Alternatively, you might create User:Example/sandbox/Template:Foo as a redirect to Template:Foo/sandbox.
  2. Go to Special:TemplateSandbox. Fill in the page or revision to be rendered, and the prefix you chose in step 1. It is possible to specify multiple prefixes (a prefix search path) by separating them using vertical bars, e.g., User:Example/sandbox1|User:Example/sandbox2.
  3. Click View.

The extension also adds a box at the bottom of the edit form for pages in the namespaces configured in $wgTemplateSandboxEditNamespaces. This allows for previewing some other page as it would appear were the template being edited saved with the current contents of the edit form. The box can be forced to appear in the edit form for any page by adding the query parameter wpTemplateSandboxShow to the URL.

See also

Category:Extensions used on Wikimedia#TemplateSandbox
Category:APIGetAllowedParams extensions Category:All extensions Category:AlternateEditPreview extensions Category:ApiMakeParserOptions extensions Category:EditPage::importFormData extensions Category:EditPage::showStandardInputs:options extensions Category:Extensions in Wikimedia version control Category:Extensions included in Canasta Category:Extensions included in Miraheze Category:Extensions included in MyWikis Category:Extensions included in Telepedia Category:Extensions included in WikiForge Category:Extensions used on Wikimedia Category:Extensions with release branches compatibility policy Category:GPL licensed extensions Category:Page action extensions Category:Special page extensions Category:Stable extensions