Help:Editing/Template

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 ." and then to use the template insert " where you want that text to appear. Then wherever this text is repeated need only be updated in the template.

Using templates from Wikipedia
Complex templates are easier obtained from Wikipedia, where considerable work has already gone into developing and debugging these. Obtain the required XML data via Special:Export. Do not include the full history or the file will become too large. Tick Include templates so that any dependencies are included. Then on the wiki use Special:Import. Also be sure to copy any relevant styling to MediaWiki:Common.css.

Because of CC-BY-SA licensing considerations try to acknowledge the source of imported templates.

Using templates from Miraheze Template Wiki
Using templates from Miraheze Template Wiki (MTW) won't prevent the wiki from having its own unique templates. The advantage of using templates from Miraheze Template Wiki is that multiple people will have already put in the effort to make highly complex templates suitable for general use. There are two ways to do this.
 * 1) See Porting templates on MTW.
 * 2) See Interwiki transcluding templates on MTW. Interwiki transclusion isn't ready yet.

Testing
For previewing a template do the following: 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.
 * 1) Copy the templates to be tested under a common prefix. For example, you might copy  to  . Alternatively, you might create   as a redirect to.
 * 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..
 * 3) Click View.