Help:Template documentation

When creating a new template, it is required that it come with some sort of documentation which can be viewed on the main template page. The following is a guide on how to write and apply template documentation.

Creating the documentation page

For any given template, defining a documentation page follows the same procedure as creating a sub-page for any article. When creating the page, the title must match the original template exactly, and then follow with /doc at the end.

From there, the editor is at liberty to decide what makes up the body of the documentation page, though there are a few guidelines to follow in that regard:

  • A good documentation page is concise and free of any superfluous language. It should read like a technical instruction manual.
  • It should include a text demonstration of how to use the template in an article, and point out any aspects which are optional.
  • It should be easy to follow, and specify exactly where and how the template should be used.

Lastly, the editor must finish the documentation page by using a <noinclude> container to place the page in the Template documentation category.

Attaching the page to the template

Once the documentation page is complete, it can be easily attached to the template in question by inserting the {{Doc}} template into a <noinclude> container within the template page. It is important not to leave the documentation page uncontained, or else it will appear with the template wherever it is used on the wiki.

Another important thing to be conscious of is that the Doc template should not be placed on a new line within the template itself, or it may result in excess line spacing being preserved in the template when it is used on a page.