Community Central

As 2021 draws to a close, let's look back at a very busy year for Fandom and our wiki communities, complete with Editors of the Year! Here is This Year at Fandom!

READ MORE

Community Central
Advertisement

Templates are a very powerful feature of MediaWiki, but can be confusing to new users and even experienced users can have difficulty making sense of the more complex ones. So, templates should have documentation to improve usability.

This documentation should explain what a template does and how to use it. It should be simple so someone without complete knowledge on how to use templates can use it correctly.

What should it include?

The documentation of some template should contain:

  • The purpose of the template; what it does/why it does that.
  • The parameters of the template.
  • Examples on how to use the templates
  • mw:Help:TemplateData
  • Related templates
  • Categories and interwikis; templates with a separate /doc subpage handle these differently.

How to add documentation

Adding the template

Adding documentation to templates is fairly easy. You do need to learn wikitext to do this.

  1. Go to a template, e.g. Template:Stub.
  2. Edit the page
  3. At the bottom of the page, add this code:
<noinclude>
<!-- Categories and interwikis go to the /doc subpage, not here! -->
{{Documentation}}
</noinclude>
  1. Save the page.

If documentation already exists, you should see text on the bottom, after the word Documentation. The display should be somewhat similar to:

Template documentation
Note: portions of the template sample might be invisible without values provided
View or edit this documentation.
Editors can experiment in this template sandbox and testcases pages.

Note: The display may vary depending on the modifications you have made on your wiki.

Creating documentation

If you have a more advanced version of the documentation template, you might see this popup when you add the {{Documentation}} template without the /doc subpage:

Documentation icon Documentation
[create | purge]

This template doesn't have any documentation yet! Help out by creating it.

Editors can experiment in this page's sandbox and testcases pages.
Subpages of this page.

You can click on the [create] link in the template, and it will preload the contents of Template:Documentation/preload. You can modify the editor text as you wish.

Otherwise, this will show: Template:<template>/doc.

Click the link, and write down the suggested contents below:

What to add to the documentation

See Template:Documentation/doc#On the Template/doc page

Categories and interwikis

If you are using a /doc subpage, here are the steps:

For the template

For categories, add:

<includeonly>
[[Category:<Category>]]
</includeonly>

Replace <Category> with the name of the category, such as Stubs.

For interwikis, add:

<includeonly>
[[<lang>:<page>]]
</includeonly>

For the /doc subpage

For categories, add:

<noinclude>
[[Category:<Category>]]
</noinclude>

Replace <Category> with the name of the category, such as Stubs.

For interwikis, add:

<noinclude>
[[<lang>:<page>]]
</noinclude>

See also

Further help and feedback

Advertisement