Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Documentation/doc: Difference between revisions

Template page
No edit summary
Prefix language interwiki links with w:
 
(42 intermediate revisions by 26 users not shown)
Line 1: Line 1:
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Uses TemplateStyles|Template:Documentation/styles.css}}
{{Uses TNT|Documentation|nocat=1}}
{{TemplateBox
{{TemplateBox
|1=1
|name = Documentation
|1d=title
|desc-en = This template automatically displays a green documentation box like you are seeing now, and automatically loads the content from a /doc subpage. It can also load the content from other places if instructed to. It is intended for pages which are [[:w:Wikipedia:Transclusion|transcluded]] in other pages, i.e. templates, whether in the template namespace or not.
|1def=The page mentioned above, the suffix /doc
  |desc-ar = <div dir="rtl"> يعرض هذا القالب بشكل آلي صندوق توثيق أخضر مثل الذي تراه الآن، ويقوم أيضاً بتحميل محتوى الصفحة الفرعية /doc. يمكن أن يُحمَّل محتوىً من صفحات أخرى إذا جرى تضمينها. هذا القالب مُصمم ليُضمن في صفحات أخرى مثل القوالب</div>
|1stat=optional
|desc-td-en = This template automatically displays a green documentation box like you are seeing now, and automatically loads the content from a /doc subpage. It can also load the content from other places if instructed to. It is intended for pages which are transcluded in other pages, i.e. templates, whether in the template namespace or not.
|2=heading
|2d=change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear. If the documentation page doesn't exist, the "edit" link includes a [[mw:Manual:Creating pages with preloaded text|preload]] parameter so that clicking it will pre-fill the edit form with the basic documentation page format.
|2def=The page mentioned above, the suffix /doc
|2stat=optional
|name=documentation
|desc=This template automatically displays a documentation box like you are seeing now, of which the content is transcluded from another page. It is intended for pages which are [[:en:Wikipedia:Transclusion|transcluded]] in other pages, i.e. templates, whether in the template namespace or not.   
|namespace=10
|usergroup=
|placement=bottom
|usage-notes=This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links. It also reduces server resources by circumventing a [[Wikipedia:Template limits|technical limitation of templates]] (see a [{{fullurl:Project:Village pump (technical)|diff=prev&oldid=69888944}} developer's explanation]).


This code should be added at the bottom of the template code, with no extra space before "<code>&lt;noinclude&gt;</code>" (which would cause extra space on pages where the template is used). The parameter can be used as shown above to transclude an arbitrary documentation page.
|1        = 1
<!-- |1aliases = List of aliases, separated by / (a slash) -->
|1label  = pagename
|1d-en    = Template name (if there's no explicit namespace, the page is assumed to be in the "Template:" namespace; to specify a page in the main namespace, prefix it explicitly with ":")
|1type    = string/wiki-page-name
|1def    = The current template page with the suffix /doc
|1stat    = optional


Add categories and interwiki links to the documentation page inside includeonly tags.
|2        = heading
|2label  = heading text
|2aliases = 2
|2d-td-en= Change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear. If the documentation page doesn't exist, the "edit" link includes a preload parameter so that clicking it will pre-fill the edit form with the basic documentation page format.
|2d-en    = Change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear. If the documentation page doesn't exist, the "edit" link includes a [[mw:Manual:Creating pages with preloaded text|preload]] parameter so that clicking it will pre-fill the edit form with the basic documentation page format.
|2type    = string
|2def    = icon and "Documentation" text
|2stat    = optional-


If the documentation page contains includeonly or noinclude tags as part of the documentation, replace the "<" with "&amp;lt;".
|3        = content
|type=
|3label  = content
|example=
|3d-en    = The content of the documentation can also be fed directly as text, instead of being specified by the name of the page containing it (parameter {{para|1}}). This option is mostly useful in a rare case where is a single documentation template is used to document many templates, with very little content change. In such a case, the {{para|content}} parameter can be used to call the documentation template with additional parameters, like <code><nowiki>content = {{Any doc page/doc |parameter1 |parameter2}}</nowiki></code>. See "Usage" section below for more examples and [[:Category:Multi-template documentation]] for examples of template documentation pages used for more than one template.
|i18n-method=autotranslate
|3d-td-en = The content of the documentation can also be fed directly as text, instead of being specified by the name of the page containing it (parameter "1="). This option is mostly useful in a rare case where is a single documentation template is used to document many templates, with very little content change. In such a case, the "content=" parameter can be used to call the documentation template with additional parameters, like "<nowiki>content = {{Any doc page/doc |parameter1 |parameter2}}</nowiki>". See "Usage" section below for more examples and "Category:Multi-template documentation" for examples of template documentation pages used for more than one template.
|i18n-desc=
|3type    = string
|i18n-mediawiki-msg=
|3def    =
|seealso=* {{tl|documentation subpage}}
|3stat    = optional-
 
|namespace = template
|usergroup = all
|placement = bottom
|type =
|setscats =
|lines = one
|shorthand =
|relieson =
|mustbesubst =
|useTemplateData = 1
|usage-notes = This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, and categories. It also reduces server resources by circumventing a [[:w:Wikipedia:Template limits|technical limitation of templates]] (see a [{{fullurl:en:Project:Village pump (technical)|diff=prev&oldid=69888944}} developer's explanation]).
 
Normally this template is used without any parameters, placed at the bottom of the template or page being documented, within a {{tag|noinclude}} container:
 
<syntaxhighlight lang="wikitext" class="nowiki">
<!--Last line of your template code--><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage -->
</noinclude>
</syntaxhighlight>
 
Then this template automatically loads the content from the /doc subpage of the template it is used on.
 
This template can also load the content from any other page. Like this:
 
<syntaxhighlight lang="wikitext" class="nowiki">
<!--Last line of your template code--><noinclude>
{{Documentation |Template:Other page/doc}}
</noinclude>
</syntaxhighlight>
 
Note that when loading the documentation from a page other than the local /doc page it becomes tricky to handle the categories.
 
The content can also be fed directly as text. Like this:
 
<syntaxhighlight lang="wikitext" class="nowiki">
<!--Last line of your template code--><noinclude>
{{Documentation
| content =
(some documentation)
}}</noinclude>
</syntaxhighlight>
 
When the {{para|content}} parameter is used, the doc box normally does not show the [edit] [purge] links in the top right corner. Note that if the /doc page exists, a link to it is still shown in the link box below the doc box.
 
Parameter {{para|1}} and the {{para|content}} parameter can also be combined, like this:
 
<syntaxhighlight lang="wikitext" class="nowiki">
<!--Last line of your template code--><noinclude>
{{Documentation |1=Template:Any page/doc
| content = {{Any page/doc |parameters}}
}}</noinclude>
</syntaxhighlight>
 
Then the pagename fed as parameter 1 is used for the [edit] [purge] links and for the /doc link in the link box below the doc box. But the '''content''' parameter is used for the content shown in the doc box. The above code means that the content is transcluded as {{tnull|Template:Any page/doc{{!}}parameters}}. In this example a parameter is also fed to the /doc page being loaded.
 
If the documentation page contains includeonly or noinclude tags as part of the documentation, replace the "<" with "&amp;lt;".  
  <!--creates loop |example = <nowiki>
|1={{FULLPAGENAME}}
|content=
== {{LangSwitch|en=Showcase|de=Schaufenster}} ==
{{LangSwitch
|en=common case:
|de=Normal- bzw. Standardfall:
}}
::<pre>{{States of Germany|prefix=|suffix=}}</pre>
::{{States of Germany|prefix=|suffix=}}
 
{{LangSwitch
|en=optionally with flags:
|de=Optional mit Länderflaggen:
}}
::<pre>{{States of Germany|flags=yes}}</pre>
::{{States of Germany|flags=yes}}
 
{{LangSwitch
|en=optionally with coats of arms:
|de=Optional mit Länderwappen:
}}
::<pre>{{States of Germany|coats=yes}}</pre>
::{{States of Germany|coats=yes}}
 
{{LangSwitch
|en=optionally without text (affects accessibility negatively (!)):
|de=Optional ohne Text (beeinträchtigt die Zugänglichkeit für einige Nutzergruppen stark negativ (!)):
}}
::<pre>{{States of Germany|compact=yes|flags=only|flagssize=48px}}</pre>
::{{States of Germany|compact=yes|flags=only|flagssize=48px}}
 
::<pre>{{States of Germany|compact=yes|coats=only|coatssize=48px}}</pre>
::{{States of Germany|compact=yes|coats=only|coatssize=48px}}
</nowiki>
|example-value ={{documentation
|1={{FULLPAGENAME}}
|content=
== {{LangSwitch|en=Showcase|de=Schaufenster}} ==
{{LangSwitch
|en=common case:
|de=Normal- bzw. Standardfall:
}}
::<pre>{{States of Germany|prefix=|suffix=}}</pre>
::{{States of Germany|prefix=|suffix=}}
 
{{LangSwitch
|en=optionally with flags:
|de=Optional mit Länderflaggen:
}}
::<pre>{{States of Germany|flags=yes}}</pre>
::{{States of Germany|flags=yes}}
 
{{LangSwitch
|en=optionally with coats of arms:
|de=Optional mit Länderwappen:
}}
::<pre>{{States of Germany|coats=yes}}</pre>
::{{States of Germany|coats=yes}}
 
{{LangSwitch
|en=optionally without text (affects accessibility negatively (!)):
|de=Optional ohne Text (beeinträchtigt die Zugänglichkeit für einige Nutzergruppen stark negativ (!)):
}}
::<pre>{{States of Germany|compact=yes|flags=only|flagssize=48px}}</pre>
::{{States of Germany|compact=yes|flags=only|flagssize=48px}}
 
::<pre>{{States of Germany|compact=yes|coats=only|coatssize=48px}}</pre>
::{{States of Germany|compact=yes|coats=only|coatssize=48px}}
}}-->
|seealso =
* {{Tl|documentation subpage}}
* {{tl2|Doc-inline}}, {{tl2|doc-end}}
* [[m:Template:Documentation]]
* [[m:Template:Documentation]]
|setscats=
* {{Tl|Description}}
|lines=one
|shorthand=
|relieson=
}}<includeonly>
[[Category:Template documentation| ]]
[[Category:Template namespace templates|{{PAGENAME}}]]


[[als:Vorlage:Dokumentation]]
| i18n-method = ext.translate
[[ar:قالب:توثيق]]
| i18n-desc =
[[ba:Ҡалып:Doc]]
Additionally, this template makes use of [[Module:TNTFallback]], [[Module:TNT]] and [[Data:I18n/Documentation.tab]].
[[bar:Vorlage:Dokumentation]]
<includeonly>
[[bg:Шаблон:Документация]]
[[Category:Templates using Module:TNT for internationalisation]]
[[bs:Šablon:Dokumentacija]]
[[ca:Plantilla:Ús de la plantilla]]
[[cs:Šablona:Dokumentace]]
[[cy:Nodyn:Doc]]
[[da:Skabelon:Dokumentation]]
[[de:Vorlage:Dokumentation]]
[[dsb:Pśedłoga:Dokumentacija]]
[[en:Template:Documentation]]
[[et:Mall:Dokumentatsioon]]
[[es:Plantilla:Documentación]]
[[el:Πρότυπο:Τεκμηρίωση προτύπου]]
[[eo:Ŝablono:Dok]]
[[eu:Txantiloi:Txantiloi dokumentazioa]]
[[fa:الگو:توضیحات]]
[[fr:Modèle:Documentation]]
[[gl:Modelo:Uso de marcador]]
[[he:תבנית:תיעוד]]
[[hsb:Předłoha:Dokumentacija]]
[[la:Formula:Documentation]]
[[ltg:Taiss:Dokumentaceja]]
[[hu:Sablon:Sablondokumentáció]]
[[hy:Կաղապար:Փաստաթղթեր]]
[[ia:Patrono:Docpatrono]]
[[id:Templat:Dokumentasi]]
[[it:Template:Man]]
[[ja:Template:Documentation]]
[[ko:틀:틀 설명문서]]
[[ku:Şablon:Belgekirin]]
[[ml:ഫലകം:വിവരണം]]
[[ms:Templat:Dokumentasi]]
[[no:mal:Dokumentasjon]]
[[nl:Sjabloon:Sjabdoc]]
[[pl:Szablon:Dokumentacja]]
[[pt:Predefinição:Documentação]]
[[ro:Format:Documentaţie]]
[[ru:Шаблон:Doc]]
[[simple:Template:Documentation]]
[[sk:Šablóna:Dokumentácia]]
[[sl:Predloga:Dokumentacija]]
[[sr:Шаблон:Документација]]
[[sq:Stampa:Dokumentacion]]
[[stq:Foarloage:Dokumentation]]
[[sv:Mall:Dokumentation]]
[[sw:Kigezo:Documentation]]
[[tr:Şablon:Belgeleme]]
[[tt:Үрнәк:Doc]]
[[tpi:Template:Template doc]]
[[uk:Шаблон:Документація]]
[[ur:سانچہ:Documentation]]
[[war:Template:Documentation]]
[[yo:Àdàkọ:Aṣàlàyé]]
[[zh:Template:Documentation]]
[[te:మూస:Documentation]]
</includeonly>
</includeonly>
}}
<includeonly>{{Sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Documentation templates]]
[[Category:Template namespace templates]]
}}</includeonly>

Latest revision as of 09:14, 12 August 2026

This template automatically displays a green documentation box like you are seeing now, and automatically loads the content from a /doc subpage. It can also load the content from other places if instructed to. It is intended for pages which are transcluded in other pages, i.e. templates, whether in the template namespace or not.

Usage

{{Documentation |1= }}

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, and categories. It also reduces server resources by circumventing a technical limitation of templates (see a developer's explanation).

Normally this template is used without any parameters, placed at the bottom of the template or page being documented, within a ‎<noinclude>...‎</noinclude> container:

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

Then this template automatically loads the content from the /doc subpage of the template it is used on.

This template can also load the content from any other page. 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 page it becomes tricky to handle the categories.

The content can also be fed directly as text. Like this:

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

When the |content= parameter is used, the doc box normally does not show the [edit] [purge] links in the top right corner. Note that if the /doc page exists, a link to it is still shown in the link box below the doc box.

Parameter |1= and the |content= parameter can also be combined, like this:

<!--Last line of your template code--><noinclude>
{{Documentation |1=Template:Any page/doc
| content = {{Any page/doc |parameters}}
}}</noinclude>

Then the pagename fed as parameter 1 is used for the [edit] [purge] links and for the /doc link in the link box below the doc box. But the content parameter is used for the content shown in the doc box. The above code means that the content is transcluded as {{Template:Any page/doc|parameters}}. In this example a parameter is also fed to the /doc page being loaded.

If the documentation page contains includeonly or noinclude tags as part of the documentation, replace the "<" with "&lt;".

Template parameters

ParameterDescriptionDefaultStatus
1pagenameTemplate name (if there's no explicit namespace, the page is assumed to be in the "Template:" namespace; to specify a page in the main namespace, prefix it explicitly with ":")The current template page with the suffix /docoptional
heading
2
heading textChange the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear. If the documentation page doesn't exist, the "edit" link includes a preload parameter so that clicking it will pre-fill the edit form with the basic documentation page format.icon and "Documentation" textoptional
contentcontentThe content of the documentation can also be fed directly as text, instead of being specified by the name of the page containing it (parameter |1=). This option is mostly useful in a rare case where is a single documentation template is used to document many templates, with very little content change. In such a case, the |content= parameter can be used to call the documentation template with additional parameters, like content = {{Any doc page/doc |parameter1 |parameter2}}. See "Usage" section below for more examples and Category:Multi-template documentation for examples of template documentation pages used for more than one template.emptyoptional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

This template automatically displays a green documentation box like you are seeing now, and automatically loads the content from a /doc subpage. It can also load the content from other places if instructed to. It is intended for pages which are transcluded in other pages, i.e. templates, whether in the template namespace or not.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
pagename1

Template name (if there's no explicit namespace, the page is assumed to be in the "Template:" namespace; to specify a page in the main namespace, prefix it explicitly with ":")

Default
The current template page with the suffix /doc
Page nameoptional
contentcontent

The content of the documentation can also be fed directly as text, instead of being specified by the name of the page containing it (parameter "1="). This option is mostly useful in a rare case where is a single documentation template is used to document many templates, with very little content change. In such a case, the "content=" parameter can be used to call the documentation template with additional parameters, like "content = {{Any doc page/doc |parameter1 |parameter2}}". See "Usage" section below for more examples and "Category:Multi-template documentation" for examples of template documentation pages used for more than one template.

Stringoptional
heading textheading 2

Change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear. If the documentation page doesn't exist, the "edit" link includes a preload parameter so that clicking it will pre-fill the edit form with the basic documentation page format.

Default
icon and "Documentation" text
Stringoptional

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

Placement: At the bottom of the page

See also

Localization

العربية  বাংলা  català  čeština  Deutsch  Zazaki  English  español  eesti  euskara  فارسی  suomi  français  galego  עברית  हिन्दी  hrvatski  magyar  Bahasa Indonesia  italiano  日本語  한국어  македонски  മലയാളം  मराठी  မြန်မာဘာသာ  norsk bokmål  Plattdüütsch  Nederlands  norsk nynorsk  polski  português  português do Brasil  русский  slovenščina  српски / srpski  svenska  ไทย  Türkçe  українська  Tiếng Việt  中文  中文(简体)  中文(繁體)

This template makes use of {{Autotranslate}} and the translate extension. The layout of the template can be found under Template:Documentation/layout.

Additionally, this template makes use of Module:TNTFallback, Module:TNT and Data:I18n/Documentation.tab.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.