Community Central
Community Central
This extension is enabled by default on Fandom.

TemplateData is a way to add computer-parsable documentation to templates. This allows the visual template editor to present general information about the template, the exact usage of the various parameters, and to format the finished source code in a uniform manner. It can serve as a very powerful form of template documentation.

TemplateData is identified by being surrounded by <templatedata> tags. The actual data is JSON code, similar to the code used for Help:Interactive Maps, but there is a visual tool to help create it, which will also insert the tags.

This is only to serve as an introduction to the use of TemplateData. See TemplateData on Mediawiki for the full documentation.

Adding TemplateData[]

TemplateData can be added to either the template page itself or to its documentation subpage. If both the template itself and the documentation subpage contains a TemplateData block, the one in the template itself will be used. It is recommended to use the documentation subpage to store it, and the rest of the guide will assume this.

The easiest way to work with TemplateData is with the template documentation editor. It works the same way in all the editors: 2010, 2017 visual, and 2017 source mode.

Screenshot of the template documentation editor when empty.

The template documentation editor

  1. Open the template documentation page for editing, e.g. Template:Stub/doc.
  2. Click "Manage TemplateData".
  3. The template documentation editor (see picture to the right) opens.
  4. Write a short description of the template in the template description field, e.g. "Marks the page as a stub."
  5. Select either "Inline" or "Block" as suggested wikitext formatting.
  6. Click "Add N suggested parameters" where "N" is the amount of parameters in your template.
  7. Add parameter information to TemplateData

    Add parameter information

    Click the 1 beside the hamburger.
  8. The parameter information view opens.
  9. Screenshot showing the parameter information view of the template documentation editor

    The parameter information view

    Fill in some of the fields, e.g. Label with "Reason", Type with "Line", and select "Required".
  10. Click Done.
  11. Click Apply. The TemplateData block is now included in the page source.
  12. Save the page as usual.

If everything went right, a table with the information you entered will be shown last in the page.

Template fields[]

Overview of the template documentation editor, showing its various fields

Overview of the template documentation editor

The template documentation editor shows an overview of the template and allows you to create and edit the TemplateData block.

Language is your chosen user interface language. If it is different from the wiki language, switch to the wiki's language. You can add it with Add language if it is not shown in the menu. The code for the chosen language is shown for various fields.

Template description also shows the code for the chosen language. It should get a short description of the purpose of the template.

Edit maps is used with some Wikimedia projects. It is not used on Fandom.

Suggested wikitext formatting allows for specific ways to format the wikitext source that is generated by the template editor.

  • Unspecified will try to preserve the source format used in an existing template, and will otherwise use inline format.
  • Inline will format the template wikitext all on one line, e.g. {{Stub|The documentation section is unfinished}}.
  • Block will format the template wikitext with one parameter per line. This is excellent for e.g. infoboxes.
  • Custom will allow a specific formatting. See custom formats in the documentation on Mediawiki.

Template parameters shows the defined parameters. You can change their order by dragging the hamburgers. Next to it is the parameter's label, with its description below. To the far right is the parameter name, as defined in the template source code. For unnamed parameters, they are shown simply as a number.

You can add extra parameters by clicking Add parameter. This will add a parameter with the label and name you enter to the templatedata block. Note that it is not possible to add unnamed parameters this way, you have to click Add 1 suggested parameters in order to add unnamed parameters. The suggestions are based on the saved template.

Parameter fields[]

Screenshot showing the parameter information view of the template documentation editor

The parameter information view

Name will be the parameter name, or a number for unnamed parameters.

Aliases allows alternative names for parameters, and is useful to link named and unnamed parameters to each other.

Label replaces the name of the parameter in the template editor, and is also shown in the list over template parameters. Highly recommended for unnamed parameters or parameter names like "row1".

Description will be shown together with the parameter name.

Example is an example of the way the parameter can be filled in, and will be shown below the parameter's value field in the template editor.

Type is a computer-readable description of the type of value the parameter holds. The most common values are:

Some plain text.
A single line of plain text.
Intended for wikitext, including links, images, or templates.
Page name
Shows a box for inserting a page name.
Shows a box for inserting a file name.
Shows a box for inserting a template name.
A single number.
1 (true), 0 (false), or blank.
A date in the YYYY-MM-DD format. Some template editors will show a date selection box.
A single full URL (e.g. "").

Suggested values will show a simple dropbox with the entered values.

Default will be shown in grey in the input box in the template editor. It will be replaced by whatever the user enters, and will not be stored if no value is entered.

Auto value is a value that automatically will be added by the template editor, if the user does not choose to enter their own value. Useful for e.g. adding {{subst:REVISIONUSER}}.

Deprecated indicates a paramater that should not be used anymore.

Required indicates a parameter which must be supplied.

Suggested indicates a parameter which is recommended to supply.

Parameters which are not deprecated, required, or suggested will be marked as optional.

Tips and good habits[]

  • Edit the TemplateData block in a different editing session than the rest of the template. That way the Add 1 suggested parameter choice will reflect the current state of the template, and you do not risk a mismatch between the source code of the actual template and the TemplateData block.
  • The individual parameters can be quite tedious to enter. Take breaks and save often, but remember to do all the steps of Done - Apply - Save page!


The TemplateData block currently only impacts the template editor. Raw source editing will completely bypass the TemplateData information.

Auto value does not function with number or date.

Wikitext is not parsed or formatted by the template documentation editor. Any wikitext entered in e.g. autovalue will be passed on raw to the page.