*** Welcome to piglix ***

Wikipedia:Template documentation


Templates are a very powerful feature of , but 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.

Template documentation should explain what a template does and how to use it. It should be simple enough that a user without complete knowledge of the intricacies of template syntax—which includes many experienced contributors who focus their attention elsewhere—can use it correctly. This is especially true in the case of very widely used templates.

Template documentation should cover:

A template's page in the is the location for the template code that controls the look and behavior of that template. What usually appears underneath the title on the rendered Template: page (as opposed to the edit window on the Edit tab or, in the case of templates whose code is protected, the View source tab, is the rendered template itself, followed by a separate section to display the template's rendered documentation, followed by the categories to which the template belongs.

However, the editable for the template's documentation is often placed on a separate subpage of the template itself, which is then transcluded at the end of the template page. This separates the often complex template code from the documentation, making the documentation easier to edit and reducing the number of accidental editing errors in the template code. It also allows templates to be protected where necessary, limiting editing access to important templates' code while allowing anyone to edit those templates' documentation. This method is sometimes referred to as the "template-doc page pattern".

Template documentation subpages should be named and formatted using the following general pattern, for consistency.

The top line will display a message explaining the current page and a link to the template page.

Insert the documentation after the top line and categories under the appropriate comment line – leaving the comment in place, so that the layout is preserved when the page is edited in future. Related templates, policy page, projects, etc. can be linked to by adding a "See also" section.


...
Wikipedia

...