Pikipedia:Template guidelines: Difference between revisions
(Created page with "Templates are special pages that are inserted into normal articles, normally with content that can change dynamically. Templates on Pikipedia should ad...") |
m (Protected "Pikipedia:Template guidelines" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[:Category:Templates|Templates]] are special pages that are inserted into normal articles, normally with content that can change dynamically. Templates on Pikipedia should adhere to the following | {{shortcut|P:TEMPLATE}} | ||
[[:Category:Templates|Templates]] are special pages that are inserted into normal articles, normally with content that can change dynamically. Templates on Pikipedia should adhere to the following guidelines. | |||
==Documentation== | ==Documentation== | ||
Every template page needs documentation on the template. The following sections should exist, when applicable: | Every template page needs documentation on the template. Make sure to wrap this in <code><nowiki><noinclude></nowiki></code> tags. The following sections should exist, when applicable: | ||
===Info=== | ===Info=== | ||
Line 8: | Line 9: | ||
===Parameters=== | ===Parameters=== | ||
If the template has any parameters, this section should detail them using a table. The following is how the | If the template has any parameters, this section should detail them using a table. The following is how the table should look like: | ||
{| class = "wikitable" | {| class="wikitable" | ||
! Parameter || Mandatory || Default || Purpose || Detailed description | ! Parameter || Mandatory || Default || Purpose || Detailed description | ||
|- | |- | ||
Line 19: | Line 20: | ||
* Parameter: The name of the parameter, or its number, in the case of parameters that are not named. | * Parameter: The name of the parameter, or its number, in the case of parameters that are not named. | ||
* Mandatory: "'''Yes'''" or "No", depending on whether the template needs the parameter to work correctly or not. | * Mandatory: "'''Yes'''" or "No", depending on whether the template needs the parameter to work correctly or not. | ||
* Default: The parameter's default value, in the case that it is optional. Special content, like <code>{{PAGENAME}}</code> should be displayed in italics. | * Default: The parameter's default value, in the case that it is optional. Special content, like <code>{{PAGENAME}}</code>, should be displayed in italics. | ||
* Purpose: This column should only exist if there are unnamed parameters. All unnamed parameters can be given a name here. | * Purpose: This column should only exist if there are unnamed parameters. All unnamed parameters can be given a name here. | ||
* Description: An explanation of the parameter. | * Description: An explanation of the parameter. | ||
Line 25: | Line 26: | ||
When creating the parameter documentation, the following code can be copy-pasted and edited accordingly: | When creating the parameter documentation, the following code can be copy-pasted and edited accordingly: | ||
<pre> | <pre> | ||
{| class = "wikitable" | {| class="wikitable" | ||
! Parameter || Mandatory || Default || Purpose || Detailed description | ! Parameter || Mandatory || Default || Purpose || Detailed description | ||
|- | |- | ||
Line 39: | Line 40: | ||
</pre> | </pre> | ||
=== | ===Skeleton=== | ||
For templates that have parameters, a template template section should be created. This is simply a snippet of MediaWiki markup surrounded by <code><nowiki><pre></nowiki></code> tags, so that editors who want to add the template to | For templates that have parameters, a template template (a template skeleton) section should be created. This is simply a snippet of MediaWiki markup surrounded by <code><nowiki><pre></nowiki></code> tags, so that editors who want to add the template to articles can just copy-paste the snippet and replace the values with their own. Value placeholders should start with < and end with >. Example of a template skeleton: | ||
<pre> | <pre> | ||
{{example | <parameter 1> | <parameter 2>}} | {{example | <parameter 1> | <parameter 2>}} | ||
Line 46: | Line 47: | ||
===Examples=== | ===Examples=== | ||
In cases of dynamic and complex templates, it may be better to have a section with examples, that shows some of the template's behavior when presented with different parameters. The examples should be displayed inside a table like | In cases of dynamic and complex templates, it may be better to have a section with examples, that shows some of the template's behavior when presented with different parameters. The examples should be displayed inside a table like so: | ||
{| class = "wikitable" | {| class="wikitable" | ||
! Code || Result | ! Code || Result | ||
|- | |- | ||
Line 58: | Line 59: | ||
* Result: What the template looks like. | * Result: What the template looks like. | ||
Like before, the following | Be careful with calling the template itself to provide the result, in cases where the template has side effects, such as adding a category to any page that includes it. | ||
Like before, the following code can be copy-pasted by editors to help create an example table: | |||
<pre> | <pre> | ||
{| class = "wikitable" | {| class="wikitable" | ||
! Code || Result | ! Code || Result | ||
|- | |- | ||
Line 69: | Line 72: | ||
</pre> | </pre> | ||
[[Category: | {{guidelines}} | ||
[[Category:Guidelines]] |
Latest revision as of 08:40, April 29, 2024
Shortcut: |
Templates are special pages that are inserted into normal articles, normally with content that can change dynamically. Templates on Pikipedia should adhere to the following guidelines.
Documentation
Every template page needs documentation on the template. Make sure to wrap this in <noinclude>
tags. The following sections should exist, when applicable:
Info
This section explains what the template does and when it should be used.
Parameters
If the template has any parameters, this section should detail them using a table. The following is how the table should look like:
Parameter | Mandatory | Default | Purpose | Detailed description |
---|---|---|---|---|
<parameter> | <mandatory> | <default> | <purpose> | <description> |
- Parameter: The name of the parameter, or its number, in the case of parameters that are not named.
- Mandatory: "Yes" or "No", depending on whether the template needs the parameter to work correctly or not.
- Default: The parameter's default value, in the case that it is optional. Special content, like
Template guidelines
, should be displayed in italics. - Purpose: This column should only exist if there are unnamed parameters. All unnamed parameters can be given a name here.
- Description: An explanation of the parameter.
When creating the parameter documentation, the following code can be copy-pasted and edited accordingly:
{| class="wikitable" ! Parameter || Mandatory || Default || Purpose || Detailed description |- ! | || || || |- ! | || || || |- ! | || || || |}
Skeleton
For templates that have parameters, a template template (a template skeleton) section should be created. This is simply a snippet of MediaWiki markup surrounded by <pre>
tags, so that editors who want to add the template to articles can just copy-paste the snippet and replace the values with their own. Value placeholders should start with < and end with >. Example of a template skeleton:
{{example | <parameter 1> | <parameter 2>}}
Examples
In cases of dynamic and complex templates, it may be better to have a section with examples, that shows some of the template's behavior when presented with different parameters. The examples should be displayed inside a table like so:
Code | Result |
---|---|
<code> |
<result> |
- Code: A snippet of MediaWiki markup that calls the template.
- Result: What the template looks like.
Be careful with calling the template itself to provide the result, in cases where the template has side effects, such as adding a category to any page that includes it.
Like before, the following code can be copy-pasted by editors to help create an example table:
{| class="wikitable" ! Code || Result |- | <pre>{{}}</pre> | {{}} |}
Pikipedia guidelines | |
---|---|
Content | Claims • General • Object list • Page title |
Specific article types |
Areas • Caves • Collectibles • Enemies • Families • Games • Pikmin types • Others |
Templates | General • Navigation box |
Conduct | Behavior |
Policies • Guidelines • Procedures • Help |