Template:Documentation
![]() | Some or all text used in this template, module, or documentation has been borrowed from Wikipedia and modified for Weezerpedia. View the original text at Wikipedia:Template:Documentation.
This page was last edited on November 12, 2024. The version on Wikipedia may have updated since then. |
![]() | This template uses Lua: |
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.
For detailed instructions on how and when to use this template, see Wikipedia:Template documentation.
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 the sandbox and testcases links.
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 at the bottom of the template page:
<!--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 optional CSS 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 from Template:Foo
.
To hide the link box, simply set |link box=
to off
.
Placement and tags
This code should be added at the bottom of the template code page, with no space before Template:Tag (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 the substitution code shortcut Template:Tlxs.
Full syntax
{{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.
- Wikipedia:Template documentation is a how-to guide to template documentation.
- Wikipedia:Template sandbox and test cases explains the use of /sandbox and /testcases subpages and includes more information about template testing.