Template:Documentation
The {{Documentation}} template is used on template pages to contain documentation, instructions and information about how the template should be used. It is also used on module /doc subpages to contain documentation for modules.
Templates are a powerful tool, and allow for the display of lots of information in a consistent and manageable way. However, they can be confusing to new users and even experienced users can have difficulty making sense of the more complex ones. Templates should therefore be accompanied by documentation to improve usability, and to encourage others to experiment with templates and use them to their maximum potential.
What to include
A template's documentation should include a brief summary of what the template is for, and where it is intended to be used. This should be followed by a breakdown of any parameters and what values they accept. Finally, there should be at least one example of the template in use.
Usage
To include {{Documentation}} on a template page, place it at the bottom of the template page, directly after the last line of code, between <noinclude>...</noinclude> tags:
~last line of your template code~<noinclude>
{{Documentation}}
</noinclude>
The documentation can then be added to the /doc subpage of the template. For example, this documentation for {{Documentation}} is located at Template:Documentation/doc.
Optionally, should the location of the appropriate documentation be located elsewhere, it can be added to the Documentation template as an optional parameter:
~last line of your template code~<noinclude>
{{Documentation|Help:Color templates}}
</noinclude>
When adding documentation located at a different title, the full page name, including namespace, must be used, even for documentation located at a different title in the template namespace.
TemplateStyles
For templates that use TemplateStyles, link to the stylesheet by adding |styles=[[link]]:
~last line of your template code~<noinclude>
{{Documentation|styles=[[Template:Example/styles.css]]}}
</noinclude>
Lua
For templates that use Lua modules, link to the module by adding |lua=[[link]]:
~last line of your template code~<noinclude>
{{Documentation|lua=[[Module:Example]]}}
</noinclude>
Archived templates
For templates that are no longer used, you can add |old=yes to include the {{OldTemplate}} template as well:
~last line of your template code~<noinclude>
{{Documentation|old=yes}}
</noinclude>
Modules
Documentation for modules must always be placed on the /doc subpage. For example, the documentation for Module:Filetype must be placed at Module:Filetype/doc. For this reason, the {{Documentation}} template must also be placed on this subpage, and the documentation entered within it. Use this syntax:
{{Documentation|module|doc=
<<your documentation here>>
}}
TemplateData
Used on template source pages, or module subpages, to contain documentation
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Documentation subpage or Module | 1 | Used to point to the full name of the documentation subpage, if it is located elsewhere, or indicate if this is module documentation
| String | suggested |
| Archived | old | Set to `yes` if the template is no longer used
| Line | optional |
| TemplateStyles | styles | Link to the stylesheet if the template uses TemplateStyles
| Line | optional |
| Lua | lua | Link to the module if the template uses a Lua module
| Line | optional |
| Module documentation | doc | The container for documentation, if used for a module | String | optional |