This template is used onapproximately 133,000 pages. To avoid major disruption and server load, any changes should be tested in the template's/sandbox or/testcases subpages, or in your ownuser subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on thetalk page before implementing them.
The{{documentation}} template is used to contain thedocumented 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 two parts: the big "documentation box" with the documentation inside alongside a toolbar (the[view][edit][history][purge] links), and the smaller "link box" that shows metadata about the documentation alongside thesandbox and testcases links.
Use of this template allows templates to beprotected, 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>...</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. Note that the /doc subpage in the link box will still show up if it exists.
Also note that when|1= and|content= is specified,|content= takes precedence and always shows in the documentation box.
Advanced syntax
Customizing the heading
The heading in the documentation box changes depending on namespace. See the below list for the default text in each namespace:
Template namespace:Template documentation
Module namespace:Module documentation
Other namespaces:Documentation
To customize the heading, simply set the parameter|heading= to anything you like, for example|heading=Infobox documentation.
Note that if the heading parameter is empty but defined (like|heading=) the heading alongside the toolbar will not show.
The|heading-style= parameter can be fed optionalCSS values, like|heading-style=font-size:150%;color:red;. Not that you should omit quotation marks" " and add the ending semicolon;.
Customizing the link box
To customize the link box, set|link box= to something else, like|link box=The above documentation is automatically generated fromTemplate:Foo.
To hide the link box, simply set|link box= tooff.
Testing
You can simulate the output for a given page by using the|page= parameter. For example, if you use the code|page=Template:Edit protected, the template will behave exactly as if it were on the pageTemplate:Edit protected, including showing the documentation fromTemplate:Edit protected/doc, linking toTemplate:Edit protected/sandbox, etc. This parameter is useful for testing and is used extensively on themodule testcases page.
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>
To automatically insert the above text, you can also use thesubstitution code shortcut{{subst:doc-code}}.
If the documentation page does not exist, the toolbar is replaced with a[create][purge] link. The[create] link automaticallycreates the page with preloaded text with the basic documentation syntax. Preload text is also used for the /sandbox and /testcases [create] links.
This template also automatically adds{{pp-template}} to a protected template page. When this template is on a /sandbox subpage, it also adds the{{Template sandbox notice}} template.
Link box features
Depending on the namespace, the link box may have less features, or may not show up at all. The following table shows this:
Namespace
Behavior
Template
Full behavior
Module
Full behavior, with the addition of a "create documentation" link when the page does not exist
User
Full behavior
Other namespaces
Hidden, unless|1= is specified (which will show "The above documentation is transcluded from{{{1}}}")
Alongside that, if|1= or|content= is specified, the "Add categories to the /doc subpage" text will not show.
In the MediaWiki namespace, since<noinclude> often does not work in system messages, and since the MediaWiki namespace needs to be kept clean for performance reasons.
When placed on talk pages, this template usually is placed near the top of the page and without<noinclude>...</noinclude> tags.
The /doc, /sandbox and /testcases pages should normally be in the subject namespace, except in the namespaces that do not have the MediaWikisubpage feature enabled: Main, File, and MediaWiki. (Categories can have subpages, but documentation is created in the Category talk namespace to prevent creating empty categories. There are also a whole bunch of other technical reasons why the /doc page must be stored under the talk page for those (but only those) namespaces.
This template automatically points its [create] links for the /doc, /sandbox and /testcases to the right namespace.
{{Documentation}}or{{Documentation| [path to documentation page]}}{{Documentation| content=}}or{{Documentation| [path to documentation page]| heading-style=| heading=| link box=}}or{{Documentation| [path to documentation page]| content=| heading-style=| heading=| link box=| page=}}
See also
{{Documentation subpage}}, a notice placed at the top of a /doc subpage explaining its role and including a link to the page it documents.