Help:Templates: Difference between revisions
MannedTooth (talk | contribs) No edit summary |
PhantomCaleb (talk | contribs) (Add lead, move types of templates off to subpage, add link section on making templates (link to separate page)) |
||
Line 2: | Line 2: | ||
:''See also: [https://www.mediawiki.org/wiki/Help:Templates Help:Templates on MediaWiki]'' | :''See also: [https://www.mediawiki.org/wiki/Help:Templates Help:Templates on MediaWiki]'' | ||
''' | A '''template''' is a page made to be included in other pages. They standardize content or formats that need to be repeated on many pages, by encapsulating them in a separate page in the <code>Template</code> {{Dict|namespace}}. They can abstract away complicated syntax, namely {{Mediawiki|parser functions}}. | ||
Templates are most often used by {{Mediawiki|transclusion}}. That is, by enclosing the name of the template page in <code><nowiki>{{double curly brackets}}</nowiki></code>. When placed in another page, the entire contents of that template page will be displayed where you placed it. Templates can have {{Dict|parameter}}s that modify their appearance or content. | |||
An example of a common template is an '''infobox''', such as [[Template:Infobox Item]]. Infobox templates appear in the upper right corner of nearly every article on the wiki. There are many other [[/Types|types of templates]]. | |||
==Using Templates== | |||
===Parameters=== | |||
Templates can have anonymous parameters, named parameters, or both. With anonymous parameters, order matters. | |||
[[Template:Item Amount]] is a template with anonymous parameters. It is used like this: <code><nowiki>{{Item Amount|SS|3|Ancient Flower}}</nowiki></code>, which produces {{Item Amount|SS|3|Ancient Flower}}. You wouldn't get the right output if you changed the order of the parameters. | |||
[[Template:Clarify]] is a template with both anonymous and named parameters. It is used like this: <code><nowiki>{{Clarify|BotW|reason= Some text here}}</nowiki></code>. There's one anonymous parameter for the game, and a named <code>reason</code> parameter for the display text. | |||
===Transclusion and substitution=== | |||
Templates can be used by {{Mediawiki|transclusion}} or by {{Mediawiki|substitution}}. When you '''transclude''' a template on a page and save it, the source will still show <code><nowiki>{{<Template name>}}</nowiki></code> when you go back to edit it. Conversely, when you '''substitute''' a template, the actual contents of the template gets copied and saved to the page. | |||
=== | {| class="wikitable" | ||
:'' | |+ Transclusion vs. substitution after saving the page | ||
! Input !! Output view !! Output source | |||
|- | |||
| <code><nowiki>{{MM}}</nowiki></code> || {{MM}} || <code><nowiki>{{MM}}</nowiki></code> | |||
|- | |||
| <code><nowiki>{{subst:MM}}</nowiki></code> || {{#switch:{{lc:{{{1}}}}} | |||
|- = ''Majora's Mask'' | |||
|himekawa = [[The Legend of Zelda: Majora's Mask (Himekawa)|''Majora's Mask'' {{#if:|(Himekawa)|manga}}]] {{#if:||by [[Akira Himekawa]]}} | |||
|item = [[Majora's Mask (Item)|Majora's Mask]] | |||
|object = [[Majora's Mask (Item)|Majora's Mask]] | |||
|#default = ''[[The Legend of Zelda: Majora's Mask|Majora's Mask]]''}} || <code><nowiki>''[[The Legend of Zelda: Majora's Mask|Majora's Mask]]''</nowiki></code> | |||
|} | |||
{{Small|In reality, [[Template:MM]] outputs something quite different when substituted, but this illustrates the point.}} | |||
Generally, templates should be substituted and not transcluded. Substitution does not preserve a reference to the template—it's like you didn't use a template at all. You lose the ability to have the content update automatically when you change the template. | |||
== | ==Making Templates== | ||
For information on how to ''make'' templates, see [[Zelda Wiki:Making Templates]]. | |||
''' | |||
==Examples== | ==Examples== |
Revision as of 21:01, 27 July 2019
Zelda Wiki's Help Guide |
Basic Editing: Getting Started Canon Policy Archiving Talk Pages |
- See also: Help:Templates on MediaWiki
A template is a page made to be included in other pages. They standardize content or formats that need to be repeated on many pages, by encapsulating them in a separate page in the Template
namespace. They can abstract away complicated syntax, namely parser functions.
Templates are most often used by transclusion. That is, by enclosing the name of the template page in {{double curly brackets}}
. When placed in another page, the entire contents of that template page will be displayed where you placed it. Templates can have parameters that modify their appearance or content.
An example of a common template is an infobox, such as Template:Infobox Item. Infobox templates appear in the upper right corner of nearly every article on the wiki. There are many other types of templates.
Using Templates
Parameters
Templates can have anonymous parameters, named parameters, or both. With anonymous parameters, order matters.
Template:Item Amount is a template with anonymous parameters. It is used like this: {{Item Amount|SS|3|Ancient Flower}}
, which produces Template:Item Amount. You wouldn't get the right output if you changed the order of the parameters.
Template:Clarify is a template with both anonymous and named parameters. It is used like this: {{Clarify|BotW|reason= Some text here}}
. There's one anonymous parameter for the game, and a named reason
parameter for the display text.
Transclusion and substitution
Templates can be used by transclusion or by substitution. When you transclude a template on a page and save it, the source will still show {{<Template name>}}
when you go back to edit it. Conversely, when you substitute a template, the actual contents of the template gets copied and saved to the page.
Input | Output view | Output source |
---|---|---|
{{MM}} |
Majora's Mask | {{MM}}
|
{{subst:MM}} |
Majora's Mask | ''[[The Legend of Zelda: Majora's Mask|Majora's Mask]]''
|
In reality, Template:MM outputs something quite different when substituted, but this illustrates the point.
Generally, templates should be substituted and not transcluded. Substitution does not preserve a reference to the template—it's like you didn't use a template at all. You lose the ability to have the content update automatically when you change the template.
Making Templates
For information on how to make templates, see Zelda Wiki:Making Templates.
Examples
The following is a list of popular notice and inline templates. A list of formatting templates can be found here. {{#css:
- restyle table td:nth-last-child(2), #restyle table td + td, #restyle table.gradient td {
border: medium none !important; background: none !important;
}
- restyle table td[width] {
border: 1px solid !important; background-color: !important;
} }}
colspan="2" style="text-align: center; background-color:; border: 1px solid;" | Notice Templates | |||
---|---|---|---|
What to type and why | What it makes | ||
{{Accuracy}}Alert readers to disputed accuracy. |
Template:Accuracy | ||
{{Ambig}}Alert readers to ambiguous canon status. |
|||
{{Archive}}or {{Archive|<page name>|<other namespace>}}Alert readers that they can read but should not edit the archive. See Template:Tl for options. |
This page is an archive of an old Talk Page. The contents have been moved from another page to clear space and to preserve history, so this page is locked from editing. If you wish to ask about the corresponding page, or respond to an earlier message, you may direct any comments to the current talk page. If you wish to refer to a message on this page, link to Help talk:Templates. | ||
{{Archives|~Start}} * <A link to an archive> * <A link to an archive> * <...and so on!> {{Archives|~Stop}}A nav template to get to archived versions. (Note: It floats to the right.) |
| ||
{{Improve|<date>|<game>}}Used to identify pages in general need of improvement. Replace <date> with that day's date or ~~~~ , and <game> with a valid name from here
|
Please improve it as you see fit. Editing help is available. This article has been flagged since <date>. | ||
{{Copyvio}}or {{Copyvio|action= |category= }}Alert editors to potential copyright issues. See Template:Tl for information on its parameter values. |
Template:Copyvio | ||
{{Imdel|<reason code>|<second file name>}}Alerts staff to an image to be deleted, and a reason. See Template:Tl for parameter information. |
|||
{{Delete|<reason>|<date>}}Alerts staff to an article to be deleted, preferably after seeking consensus. |
This page may meet Zelda Wiki's criteria for deletion. Reason: <reason> This page has been flagged for deletion since <date>. | ||
{{Disambig}}Alerts readers that the page is a disambiguation page for articles of the same name, designed to list these articles. Such a page is usually found from performing a search. (An article should not link to such a page if the intended topic has its own specific article). |
| ||
{{Fact}}or {{Fact|<game>}}(Inline template) Notifies editors that a source is needed for a statement. See Template:Tl for specifying which game(s) it relates to (<game>). |
[citation needed] | ||
{{Future Release}}or {{Future Release|<cat sort>}}Use on content concerning unreleased material. See Template:Tl for <cat sort>. |
This article or section contains information about a Future Release. It is likely to contain information of a speculative nature and the content may change dramatically as more information becomes available. | ||
{{Gallery}}or {{Gallery|<gallery page name>}}If the article topic has its own gallery page, use to send viewers to this page. (Gallery:Link used for <gallery page name> in this example) |
|||
{{Guide2}}or {{Guide2|<area>|<date>|<cat sort>}}Notifies editors to remove the strategy guide style of the article. For <area>, put Article or Section corresponding to where the template needs to be, and is, placed. |
Template:Guide2 | ||
{{subst:Howtosig}}A message to inform people that haven't been signing their talkspace posts. Use this as a message on their User Talk page. Note that the template does not automatically sign it for you. |
SignaturesHello, <User>! I noticed that you seem to be having some trouble with the signature coding — don't worry, it happens a lot. You only need to type one thing:
That's it. Just those four tildes. They automatically add your name and the time you made your post, so you don't have to type any of that yourself! | ||
{{subst:Hi}}A message the bot will automatically send to all new users. |
Hello
| ||
{{Images}}or {{Images|<game>}}Post this on articles lacking images. |
Template:Images | ||
{{Incomplete Coding}}Note that not all browsers are equal. Some users may place this on articles that seem fine, but are a mess in their browser, so even if it looks fine, if possible don't remove it before asking the one who placed it. |
Template:Incomplete Coding | ||
{{Bad lead}}Used to flag a lead (or lede) that does not properly summarize its article's contents. |
Template:Bad lead | ||
{{Merge|Link|Princess Zelda|<etc.!>|<up to 20!>}}For example, when placed on article A, it is used to suggest that article A is merged with Link, Princess Zelda, ... . It should appropriately be placed on Link, Princess Zelda, ... also. |
It has been suggested that this article or section be merged with Link, Princess Zelda, [[<etc.!>]] and [[<up to 20!>]]. Discuss this on the article's talk page. | ||
{{Move|<to here>}}or {{Move|<to here>|<or maybe here>}}Use to recommend moving a page to a new title. |
It has been suggested that this article be moved to [[<to here>]] or [[<or maybe here>]]. This page either already exists and is preventing the move, or the move may be either controversial or entail multiple edits. Please discuss this on this article's talk page. | ||
{{Name|Fan|<Name>}}This template indicates names that are purely fan creations. |
<Name> | ||
{{Neutrality|<cat sort>}}Notifies editors of potential bias on a subject. |
The neutrality of this article or section is disputed. Please see the relevant discussion on the article's talk page. | ||
{{News Archive}}A hybrid notice and navigation template for the News archives. |
|||
{{Noclog}}Helps clear out the Wanted Pages. Pages that use it. |
Template:Noclog | ||
{{Noncanon}} or wrap some content: {{Noncanon|Start}} Content {{Noncanon|End}}Alerts readers to the canon status of an article or, in the latter, article section. The former is used to illustrate: |
|||
{{Nosig|<username>|<date/time>}}Identify talkspace posters that did not sign the post with name and time. <date> is generally ~~~~~ |
Template:Nosig | ||
{{subst:Nosrc}}A message to editors that uploaded images without sourcing them. Note that the template does not automatically sign it for you. |
Image(s) uploadedHi! Thank you for the new image(s) you recently uploaded; the wiki appreciates your contributions! We've introduced a policy of crediting the original source of any images used here, so we ask that you please take a moment to let everyone know where your images came from using Template:Tl. For more information, see this explanation, and any questions you may have will be answered by the staff here. Thanks for your help! | ||
{{OT}}Informs talkspace posters that the discussion is not related to the wiki. |
Template:OT | ||
{{Protect|<cat sort>}}Informs the staff of a page that may need to be protected. |
Template:Protect | ||
{{Protected}}Informs editors that a page has been fully protected (only administrators can edit it). It is a key icon (as illustrated) to the right of page title. |
|||
{{Split|<Section Name>}}Used when suggesting an article's section be split away into its own page. |
It has been suggested that the portion of this page concerning [[#<Section Name>|<Section Name>]] should be made into its own page. Should the target page already exist, this content should be merged into it where appropriate. Discuss this on article's talk page. | ||
{{Harmonize|Link|Princess Zelda|<etc.!>|<up to 20!>}}Alerts users that an article does not properly complement some other articles, e.g. Link, Princess Zelda, etc. |
The following text needs to be harmonized with text in Contents, Citing Sources, [[<etc.!>]] and [[<up to 20!>]]. Discuss this on the article's talk page. | ||
{{Sectstub}}Marks a specific section of an article as a stub (too short). If the stub section covers multiple games, use additional parameters, e.g. {{Sectstub|OOT|MM|TWW|TP}}. |
|||
{{Sources}}To be placed above articles that generally lack references. If the article covers multiple games, use additional parameters, e.g. {{Sources|OOT|MM|TWW|TP}}. |
Template:Sources | ||
{{Stub}}Tags an article as a stub (too short). If the stub article covers multiple games, use additional parameters, e.g. {{Stub|OOT|MM|TWW|TP}} |
| ||
{{Theory}} or wrap some content: {{Theory|Start}} Content {{Theory|End}}This template indicates that either a section or an entire article contains unconfirmed fan theories. The former is used to illustrate: |
Theory Warning | ||
{{subst:Uncon|<Article Name>}}A canned (i.e. prewritten) message to send to a user (put on their talk page) after reverting an edit of theirs made on an article that was nonconstructive (See message:). Note that the template does not automatically sign it for you. |
Nonconstructive EditsHello! The recent edit(s) you have made to the page, [[<Article Name>]], do not appear to be constructive and have been reverted. Please refrain from adding nonsense or irrelevant content to Zelda Wiki. If you are not sure what content is acceptable, then see our Quality Standards. If you would like to experiment with editing, please use the Sandbox. If you feel that there has been a mistake and that you believe that your edits were valid, then report it on that page's respective talk page. | ||
{{Undated|<date/time>}}Similar to the Nosig template, but specifically for signed, but not dated, talkspace posts. |
—Preceding undated comment added on <date/time> | ||
{{Update}}Notifies editors of articles that are out of date following the release of new information, namely new Zelda games. See Template:Tl for more options. |
|||
{{User}}Filler/Placeholder information to put on a user page that has not been created and is on the wanted pages list. |
This text was placed here to eliminate the user's user page from clogging up Wanted Pages and/or to remove redlinks from talk pages. If you are the user, please feel free to let the public know a little more about you. | ||
{{Vandalism|<date/time>}}Notifies editors of a frequently vandalized page's current protected status. |
| ||
{{Wikipedia|<article title>}}Links to a Wikipedia article. The example links to the "Satoru Iwata" article on Wikipedia. |
See also: Satoru Iwata on | ||
{{YouLink}}Flags articles with out-of-universe speaking style. |
Template:YouLink |