Template:Documentation/doc

From Rhythm Heaven Wiki
< Template:Documentation
Revision as of 19:06, 10 July 2025 by HyperNervie (talk | contribs) (Category change)
Jump to navigation Jump to search

The {{documentation}} template is used to contain the documented information and instructions of a certain template, usually from a /doc subpage. It can also be configured to load the content from other pages or be directly fed by text.

This template has the documentation wrapped in a big documentation box that has a header and a footer: the header tells readers that this is a documentation and shows a dropdown tool bar at the top right corner; the footer tells readers the source of the documentation (either transcluded from another page or inlined), alongside a link to this template.

Use of this template allows templates to be protected, where necessary, while allowing anyone to edit the documentation and categories.

General syntax

Normally, the template is used without parameters and is placed inside <noinclude> at the bottom of the template page (see #Placement and tags for more information):

<!--Last line of your template code--><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage -->
</noinclude>

Transcluding a different page

To transclude a different page other than the /doc subpage, simply provide |1= like this:

<!--Last line of your template code--><noinclude>
{{Documentation|Template:Other page/doc}}
</noinclude>

Note that when loading the documentation from a page other than the local /doc subpage, it becomes tricky to handle the categories.

Using the |content= parameter

The documentation can also be fed directly as text, by using the |content= parameter:

<!--Last line of your template code--><noinclude>
{{Documentation
 | content =
<!-- template documentation -->
}}</noinclude>

When using this parameter, the toolbar will not show.

Also note that when |1= and |content= is specified, |content= takes precedence and always shows in the documentation box.

Customizing the header

The header in the documentation box changes depending on namespace. See the below list for the default text in each namespace:

  • Template namespace: Template-info.svg Template Documentation
  • Module namespace: Template-info.svg Module Documentation
  • Other namespaces: Template-info.svg Page Documentation

To change the word before "Documentation", simply set the parameter |type= to anything you like, for example |type=Infobox.

Placement and tags

This code should be added at the bottom of the template code page, with no space before <noinclude> (which causes extra whitespace to show on pages where the template is transcluded):

<!--Last line of your template code--><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage -->
</noinclude>

See w:Wikipedia:Template documentation#Where to place it for further information.

Categories and interwikis

Depending on where to the documentation is placed, it may be tricky to handle the categories and interwikis. See w:Wikipedia:Template documentation#Categories and interwiki links for information about adding these.

Automatic functions

If the documentation page does not exist, the body of the documentation box will say "Documentation page link to doc doesn't exist. Click the link to create one!" where link to doc is a red link to the wanted page. The toolbar is not shown in this case.

Template alias