- このヘルプには更新、または翻訳されていないコンテンツがあります。どなたでも翻訳にご協力いただくことができます。
- 原文 : w:Help:Template documentation。
Templates are a very powerful feature of MediaWiki, but they can be confusing to new users, and even experienced users can have difficulty making sense of the more complex ones. So, templates should have documentation to improve usability. This documentation should explain what a template does and how to use it. It should be simple so someone without complete knowledge of how to use templates can use it correctly.
What should it include?[]
The documentation of some template should contain:
- The purpose of the template; what it does/why it does that.
- The parameters of the template.
- Examples on how to use the templates.
- TemplateData.
- Related templates.
- Categories and interwikis; templates with a separate /doc subpage handle these differently.
How to add documentation[]
Adding the template[]
Adding documentation to templates is fairly easy. You do need to learn wikitext to do this.
- Go to a template, e.g. Template:Stub.
- Edit the page.
- At the bottom of the page, add this code:
- Save the page.
If documentation already exists, you should see text on the bottom, after the word Documentation. The display should be somewhat similar to:
Template documentation
|
---|
Note: portions of the template sample may not be visible without values provided. |
View or edit this documentation. (About template documentation) |
Editors can experiment in this template's sandbox and test case pages. |
Note: The display may vary depending on the modifications you have made on your wiki.
Creating documentation[]
If you have a more advanced version of the documentation template, you might see this popup when you add the テンプレート:Tlx template without the /doc subpage: テンプレート:Delink You can click on the [create] link in the template, and it will preload the contents of Template:Documentation/preload. You can modify the editor text as you wish. Otherwise, this will show: Template:<template>/doc. Click the link, and write down the suggested contents below:
What to add to the documentation[]
There are many formats for writing template documentation. Be sure to read your wiki's rules to see if there is a standardized guide for this. If there isn't, feel free to copy the below formats. You can also customize/adopt them to your wiki.
Basic format[]
== Description == This template is used to do something... == Syntax == {{t|Template}} == Sample output == <code>{{Template}}</code> gives: {{Template}}
This is the most basic format for a template. It can be expanded, depending on what you want. An alternative way to write this is by using description lists:
; Description : This template is used to do something... ; Syntax : {{t|Template}} ; Sample output : <code>{{Template}}</code> gives: : {{Template}}
Templates with parameters[]
For templates with parameters, it depends on what you want:
If the template is used on articles, adding TemplateData can be helpful, below the parameter list.
Add this code below == Syntax ==
:
=== Parameters === ; <code>param=</code> : This parameter does abc. === TemplateData === <templatedata>{}</templatedata>
Categories and interwikis[]
If you are using a /doc subpage, apply the following steps inside the subpage, not the template itself:
For the template[]
For categories, add:
Replace <Category> with the name of the category, such as Stubs. For interwikis, add:
For the /doc subpage[]
For categories, add:
Replace <Category> with the name of the category, such as Stubs. For interwikis, add:
関連情報[]
- Wikipedia:Template documentation
- ヘルプ:テンプレート/レイアウト
- ヘルプ:テンプレート
- ヘルプ:ウィキテキスト
- Template:Documentation/common on Templates Wiki
- Template:Documentation on Dev Wiki, a Lua version of the above page.
その他のヘルプとフィードバック[]
- ヘルプ:コンテンツでは、他のヘルプページを閲覧、検索することができます。
- 最新の情報やヘルプについては、コミュニティセントラルをご覧ください。
- この記事で不明確な点や、曖昧な点がございましたら、Fandomとの連絡方法をご確認ください。
- このヘルプはコミュニティセントラル内にて管理されています。