Revision as of 08:36, 5 September 2017 by Rob Kam (talk | contribs) (Rob Kam moved page Help:Editing/Template to Help:Template)
Jump to navigation Jump to search

A template is a page that gets included in another page, this other page is said to transclude the template. This is useful for text that is often repeated. For example, create a page called "Template:Main article" with the text "The main article for this is at [[{{{1}}}]]." and then to use the template insert "{{Main article|Whatever}} where you want that text to appear. Then wherever this text is repeated need only be updated in the template.

For previewing a template 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 by separating them using vertical bars, e.g. User:Example/sandbox1|User:Example/sandbox2.
  3. Click View.

There is also a box at the bottom of the edit form which allows for previewing some other page as it would appear were the template being edited saved with the current contents of the edit form.

See also