Difference between revisions of "Help:Templates"

From The Coppermind
Jump to navigation Jump to search
m
(→‎Other Templates: added a description of source for quotes)
 
(30 intermediate revisions by 8 users not shown)
Line 1: Line 1:
  +
{{HelpToC}}
So you want to know how to use templates? You're in the right place.[[Category: Templates|*]][[Category: Help]]
 
  +
'''Templates''' make more complicated and repetitive editing tricks easier to do. This page will explain how to create and use them. For more details, see Wikipedia's Help page on [https://en.m.wikipedia.org/wiki/Help:Template Templates].
   
  +
== Using Templates ==
First off, to use a template you insert it's name in <code><nowiki>{{curly brackets}}</nowiki></code>.
 
  +
Most templates that you may need to use already exist, so let's talk about ''using them'' first.
Most templates ask for parameters which are passed as so: <code><nowiki>{{eg|first argument|second|foo=named argument}}</nowiki></code>.
 
You see the <code>foo=</code> part? That's a named argument, and is used for special parameters, such as the [[Template:Infobox|infobox]] field names.
 
   
  +
Templates are enclosed by double curly braces (<code>{{</code> and <code>}}</code>). The ''template name'' comes first, followed by ''parameters'', all separated by vertical bars (<code>|</code>). It looks something like this: <code><nowiki>{{name|param1|param2|param3}}</nowiki></code>.
== Information boxes ==
 
The {{t|infobox}} templates are shown at the right-hand corner of articles, the display important facts and statistics which are common to group of articles. They are placed at the start of the article, and show a list of information down the right side of the article.
 
   
  +
Note that some templates are entered in a single line of text, like the example above. This is common for reference templates and those which don't require any parameters. However, it is not uncommon for templates to span multiple lines, for the sake of clarity. Something more like:
* {{t|book}} includes information on the publisher and ISBN of a book
 
* {{t|character}} includes information regarding the character
 
* {{t|place}} information on a place, region, or building.
 
* [[:Category: Infoboxes|Full list of Infoboxes]]
 
   
  +
<pre style="white-space:pre-wrap; width:100px">
== Navigation boxes ==
 
  +
{{name
Navboxes are footer templates that are placed at the bottom of a page to allow people to find related content.
 
  +
|param1
  +
|param2
  +
|param3
  +
}}
  +
</pre>
   
  +
=== Parameters ===
*{{t|cosmere}} inserts a table of links relating to [[Adonalsium]] and the [[Cosmere]] at large
 
  +
There are two kinds of parameters: '''named''' and '''unnamed'''. Named parameters are identified by the name of the parameter while unnamed parameters are identified simply by the order they appear.
*{{t|books}} inserts a table of books and series' by [[Brandon Sanderson]]
 
*{{t|Elantris}} contains major articles about ''[[Elantris (book)|Elantris]]''
 
*{{t|Mistborn}} has stuff about the ''[[Mistborn series]]''
 
**{{t|Mistborn trilogy 1}}, {{t|Mistborn Adventures}} or {{t|Mistborn adventure game}} should be included on pages relaitng to those series
 
**{{t|Metallic arts}} inserts a table of the magics found on [[Scadrial]]
 
*{{t|Stormlight}} is the best place to start looking at stuff from ''[[The Stormlight Archive]]''
 
*{{t|Warbreaker}} has lots of links about ''[[Warbreaker]]'' and ''[[Nightblood]]''
 
* [[:Category: Navbars|Full list of Navbars]]
 
   
  +
;Named Parameters
*{{t|holder}} indicates the holder of a title or other thing, and possible predecessors and successors.
 
  +
: ''Named parameters'' require the parameter name and an equals sign (<code>=</code>) followed by your input. If <code>param1</code> is a named parameter of {{t|example}}, and you want the input to be "Mistborn", then you will enter <code><nowiki>{{example|param1=Mistborn}}</nowiki></code>.
   
  +
;Unnamed Parameters
== [[:Category: Link macros|Link macros]] ==
 
  +
: ''Unnamed parameters'' should be completely replaced by your input. If <code>param1</code> is an unnamed parameter of {{t|example}}, and you want the input to be "Mistborn", then you will enter <code><nowiki>{{example|Mistborn}}</nowiki></code>.
*{{t|demonym}} returns the correct [[Wikipedia: demonym|demonym]] for a place
 
*{{t|toponym}} returns correct [[Wikipedia: toponym|toponyms]]
 
   
  +
=== Example ===
== [[:Category: Reference templates|Citation templates]] ==
 
  +
Let's look at an example using the {{t|character}} template, which is used to create the infobox at the top of articles about characters. It creates a table with information that commonly pertains to characters. The different fields of the table are entered as parameters.
The following templates can be used to easily add references to different resources
 
* {{t|17s ref}} will link to the 17th Shard forum
 
* {{t|article ref}} will link to
 
* {{t|bws ref}} link to any page on Brandon's site
 
* {{t|book ref}} adds a chapter summary reference
 
* {{t|annotation ref}} will link to an annotation on Brandon's site using the same parameters as {{t|book ref}}
 
* {{t|epigraph ref}} links to the epigraph list
 
* {{t|file ref}} easily link to a file uploaded to the coppermind
 
* {{t|map ref}} link to a specific map on the coppermind
 
* {{t|glossary ref}} link to a glossary section
 
* {{t|qa ref}} refer to a [[Theoryland Interview Database]] question/answer
 
* {{t|url ref}} link to a general url
 
* {{t|tor ref}} link to a page on tor.com
 
* {{t|tweet ref}} link to a tweet on twitter
 
* {{t|wp ref}} refer to a wikipedia article
 
   
  +
{| width=100% class=wikitable
* {{t|ref}} should be used to generate extra links to other named references
 
  +
|-
  +
| width=50%|When used in the [[Kelsier]] article, this...
  +
|...produces:
  +
|-
  +
|<pre>
  +
{{character
  +
|image=Kelsier.jpg
  +
|abilities=[[Allomancy|Mistborn]]
  +
|spouse=[[Mare]]
  +
|siblings=[[Marsh]]
  +
|titles=Survivor
  +
|born=c. 984 FE
  +
|world=Scadrial
  +
|ethnicity=Skaa
  +
|residence=Luthadel
  +
|books=[[Mistborn (series)]]
  +
}}
  +
</pre>
  +
|
  +
{{example
  +
|name=Kelsier
  +
|image=Kelsier.jpg
  +
|abilities=[[Allomancy|Mistborn]]
  +
|spouse=[[Mare]]
  +
|siblings=[[Marsh]]
  +
|titles=Survivor
  +
|born=c. 984 FE
  +
|world-raw=Scadrial
  +
|ethnicity-raw=Skaa
  +
|residence=Luthadel
  +
|books=[[Mistborn (series)]]
  +
}}
  +
|}
   
== Editorial notations ==
+
== Types of Templates ==
  +
Let's go over the common types of templates you may encounter and make use of.
These templates are used to
 
*{{t|cite}} requests that someone insert a citation about the fact preceding it.
 
*{{t|clarify}} asks someone edit the page to clear up ambiguous statements
 
*{{t|disputed}} warn the reader that a fact may be incorrect or unverified
 
   
== Navigation aids==
+
=== Information Boxes ===
  +
Called '''infoboxes''' for short, these templates create the tables at the upper right hand corner of articles. They display important facts and details which are common to articles of the same category. Infoboxes are ''placed at the start of the article''. There are infobox templates for all of the high level content categories, and a few others that are more specific. Common examples include {{t|book}}, {{t|character}}, {{t|magic system}}, and {{t|location}}.
These templates insert boxes or emphasised phrases that help users navigate the wiki correctly.
 
*{{t|for}} helps users distinguish between similarly titled articles.
 
   
  +
For more detailed help on infoboxes in general see [[:Help: Infoboxes]] and for a full list of infobox templates, see [[:Category: Infoboxes]].
== [[:Category:Notices|Notices]] ==
 
{{t|Notice}} templates insert boxes that alert users to information regarding the page its self.
 
*{{t|attention}} requests that users edit it
 
*{{t|copyright}} ask the user not to copy the content on the article
 
*{{t|theory}} stipulates that the article or section should not be considered canon
 
*{{t|spoilers}} warns users about new material they may not have read yet
 
*{{t|delete}} and {{t|Move}} indicate possible administrative action
 
*{{t|stub}} can be used to signify that an article is unfinished
 
*{{t|complete}} should be used at the bottom of short articles when there is nothing more to add.
 
   
== Other Templates ==
+
=== Navigation Boxes ===
  +
Called '''navboxes''' for short, these templates create the tables at the bottom of pages that link to other important articles that are related to the same book or series. Most series or standalone books have a navbox that refers to important characters, places, etc. Navboxes are placed at the end of the article, directly after the <code><nowiki><references /></nowiki></code> tag. Common examples include {{t|Cosmere}}, {{t|Stormlight}}, and {{t|Reckoners}}.
*{{t|b}} converts an acronym or malformed book title into the correctly formatted title.
 
  +
*{{t|columns}} allows you to format a list (the first parameter) into <code>count</code> columns.
 
  +
For a full list of navbox templates, see [[:Category:Navbars]].
*{{t|quote}} surrounds the first parameter as a block quote, with the second parameter as a source.
 
  +
  +
=== Notices ===
  +
Notice templates alert users and editors of important information regarding the page itself. Some notable notice templates are listed below. For a full list of notice templates, see [[:Category:Notices]].
  +
  +
;{{t|attention}}
  +
: Makes note at top of page that article needs attention and categorizes the article accordingly. Place directly after infobox.
  +
  +
;{{t|copyright}}
  +
: Asks users not to copy the content on the article.
  +
  +
;{{t|theory}}
  +
: Warns that the article or section contains speculation and should not be considered canon. Place directly after infobox or directly after section heading.
  +
  +
;{{t|spoilers}}
  +
: Warns that the article contains information pertaining to recently published material that many users may not have read yet. Place directly after infobox.
  +
  +
;{{t|delete}}
  +
: Requests that an administrator delete the page.
  +
  +
;{{t|move}}
  +
: Requests that an administrator move the page (change the title). An unnamed parameter may be included to indicate which page it should be moved ''to''.
  +
  +
;Quality Tags
  +
: Quality tags are simple templates that indicate the level of completion/quality of an article and categorize it accordingly. These are discussed in detail on the [[:Help:Categories#Quality_Tags|Help:Categories]] page and include {{t|stub}}, {{t|partial}}, and {{t|complete}}
  +
  +
=== Reference Templates ===
  +
Reference templates are used to cite the source of information in an article. They create a superscript number that links to the footnotes in the "Notes" section, where the full reference is provided. For more on reference templates, see [[:Help:References]].
  +
  +
=== Link Macros ===
  +
Link macros are templates which link to something that's related to the input. They often categorize the article as well. For a full list of link macros, see [[:Category:Link macros]].
  +
  +
=== Editorial Notations ===
  +
Editorial notations are used to highlight information which is unsupported, ambiguous, or questionable. For more, see [[:Help:References#Editorial_Notations|Help:References]].
  +
  +
=== Other Templates ===
  +
Some other notable templates include the following:
  +
  +
;{{t|b}}
  +
: This is a simple template that outputs a full book or series title given an abbreviated or shorthand reference. For example, "<code><nowiki>{{b|sa1}}</nowiki></code>" returns "{{b|sa1}}" (i.e. Stormlight Archive book 1).
  +
  +
;{{t|columns}}
  +
: Use the {{t|columns}} template to create columns. Use <code><nowiki>{{columns|count=N|TEXT}}</nowiki></code>, where <code>N</code> is the desired number of columns and <code>TEXT</code> is the content to be split up into columns. Separate items in <code>TEXT</code> by using line breaks or lists. Note that <code>|count=N</code> may be omitted; the number of columns is 3 by default.
  +
: {| width=100% class=wikitable
  +
|-
  +
| width=50%|This...
  +
|...produces:
  +
|-
  +
|<pre style="white-space:pre-wrap; width:200px">
  +
{{columns|count=2|
  +
* Item 1
  +
* Item 2
  +
* Item 3
  +
* Item 4
  +
* Item 5
  +
}}
  +
</pre>
  +
|{{columns|count=2|
  +
* Item 1
  +
* Item 2
  +
* Item 3
  +
* Item 4
  +
* Item 5
  +
}}
  +
|}
  +
  +
;{{t|quote}}
  +
: Use {{t|quote}} to highlight some text as a quote. Use <code><nowiki>{{quote|TEXT|SOURCE}}</nowiki></code>, where <code>TEXT</code> is the quote itself and <code>SOURCE</code> is the source of the quote (typically the name of the speaker or a short description of the context, followed by a [[:Help:References|reference]]). <code><nowiki>{{quote|Do or do not. There is no try.|Yoda}}</nowiki></code> produces:
  +
: {{quote|Do or do not. There is no try.|Yoda}}
  +
  +
;{{t|sidequote}}
  +
: {{sidequote|Do or do not. There is no try.|Yoda|side=right|size=300px}} Use {{t|sidequote}} to place a quote on one side of the page, with text floating around it. Use <code><nowiki>{{sidequote|TEXT|SOURCE|POSITION|WIDTH}}</nowiki></code>, where <code>TEXT</code> is the quote itself, <code>SOURCE</code> is the source of the quote, <code>POSITION</code> is the alignment of the quote (<code>left</code> or <code>right</code>), and <code>WIDTH</code> is some number followed by "px", to specify the width of the quote in pixels. When placed at the top of this paragraph, <code><nowiki>{{sidequote|Do or do not. There is no try.|Yoda|side=right|size=300px}}</nowiki></code> produces the quote to the right.
  +
  +
;{{t|for}}
  +
: This template provides a quick and clean way to refer to other articles. It generally takes one unnamed parameter, <code>{{{1}}}</code>, as input. By default, it returns "For more information, see <code>{{{1}}}</code>", where <code>{{{1}}}</code> is a link to the referenced article. A second unnamed parameter will replace "more information" and a third will replace the text which refers to the linked article. For example, <code><nowiki>{{for|cosmere|oodles of information|this page about the cosmere}}</nowiki></code> produces:
  +
: {{for|cosmere|oodles of information|this page about the cosmere}}
  +
  +
== Template Pages ==
  +
Templates are created just like articles and categories: you create a page for one in the Template namespace. You should find documentation for a template on this page. It will provide a description of what the template does, a list of required and acceptable parameters, and occasionally some examples.
  +
  +
== Editing Templates ==
  +
Editing templates (or creating one from scratch) is definitely not a task for beginners. But we'll go over some of the basics.
  +
  +
=== Includeonly and Noinclude ===
  +
;<code><nowiki><includeonly></nowiki></code> Tag
  +
: Everything you want the template to do when used on other pages should be sandwiched between <code><nowiki><includeonly></nowiki></code> and <code><nowiki></includeonly></nowiki></code> tags.
  +
  +
;<code><nowiki><noinclude></nowiki></code> Tag
  +
: The template's documentation, and anything else you want to show up on the template page itself, must be sandwiched between <code><nowiki><noinclude></nowiki></code> and <code><nowiki></noinclude></nowiki></code> tags.
  +
  +
=== Parameters ===
  +
;Named Parameters
  +
: ''Named'' parameters are referred to by their name in triple braces. For example, the named parameter "books" in the {{t|character}} template is referred to as <code>{{{books}}}</code>.
  +
  +
;Unnamed Parameters
  +
: ''Unnamed'' parameters are referred to by the order they are entered. For example, the first unnamed parameter that is entered in the {{t|book ref}} template is referred to as <code>{{{1}}}</code>, while the second is referred to as <code>{{{2}}}</code>.
  +
  +
;Defaults
  +
: Provide a default value for parameters by including a vertical bar (<code>|</code>) followed by the default value. To use a null default value, enter nothing after the vertical bar. For example, if you want the first unnamed parameter to have a default value of "Sanderson", use <code><nowiki>{{{1|Sanderson}}}</nowiki></code>.
  +
  +
=== Parser Functions ===
  +
There are a number of functions that can be used to generate different results based on the input provided. For an extensive list, see [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions MediaWiki's Parser Functions] page. Here are some of the basics:
  +
  +
;Uppercasing Text
  +
: This function converts a string of text to all uppercase.
  +
: ''Use:'' <code><nowiki>{{uc: TEXT}}</nowiki></code>, where <code>TEXT</code> is the text to be converted.
  +
: ''Example:'' <code><nowiki>{{uc: heLLo}}</nowiki></code> produces <code>HELLO</code>.
  +
  +
;Lowercasing Text
  +
: This function converts a string of text to all lowercase.
  +
: ''Use:'' <code><nowiki>{{lc: TEXT}}</nowiki></code>, where <code>TEXT</code> is the text to be converted.
  +
: ''Example:'' <code><nowiki>{{lc: heLLo}}</nowiki></code> produces <code>hello</code>.
  +
  +
;String Compare
  +
: This function compares two strings of text and provides one of two results.
  +
: ''Use:'' <code><nowiki>{{#ifeq: A|B|Result1|Result2}}</nowiki></code>, where <code>A</code> and <code>B</code> are the strings of text. If <code>A=B</code> then <code>Result1</code> is returned; otherwise, <code>Result2</code> is returned.
  +
: ''Example:'' <code><nowiki>{{#ifeq: dog|dog|same|different}}</nowiki></code> produces <code>same</code> and <code><nowiki>{{#ifeq: dog|cat|same|different}}</nowiki></code> produces <code>different</code>.
  +
  +
;If-Then
  +
: This function checks if a parameter exists and provides one of two results.
  +
: ''Use:'' <code><nowiki>{{#if: A|Result1|Result2}}</nowiki></code>, where <code>A</code> is some parameter. If <code>A</code> exists (i.e. it isn't null) then <code>Result1</code> is returned; otherwise, <code>Result2</code> is returned.
  +
: ''Example:'' If a second unnamed parameter is provided, <code><nowiki>{{#if: {{{2|}}}|hello|goodbye}}</nowiki></code> produces <code>hello</code>. If not, it produces <code>goodbye</code>.
  +
  +
;Case-Switch
  +
: This function performs a series of string compares until a "true" result is found.
  +
: ''Use:'' <code><nowiki>{{#switch: X|A=Result1|B=Result2|C=Result3|etc.|Default}}</nowiki></code>, where <code>X</code> is compared to <code>A</code>, <code>B</code>, and so on. The first match provides the corresponding result. A final, default result may be provided in case no match is found.
  +
: ''Example:'' <code><nowiki>{{#switch: cat|dog=bark|cat=meow|growl}}</nowiki></code> produces <code>meow</code> and <code><nowiki>{{#switch: bear|dog=bark|cat=meow|growl}}</nowiki></code> produces <code>growl</code>.
  +
  +
=== System Variables ===
  +
There are a few system variables which provide different values as needed. These are given in all caps between double curly braces. For an extensive list, see [https://www.mediawiki.org/wiki/Help:Magic_words MediaWiki's Magic Words] page. The two most common are:
  +
  +
;Pagename
  +
: <code><nowiki>{{PAGENAME}}</nowiki></code> provides the name of the page/article. If used in this page it would yield <code>Templates</code>.
  +
  +
;Namespace
  +
: <code><nowiki>{{NAMESPACE}}</nowiki></code> provides the name of the page's namespace. If used in this page it would yield <code>Help</code>.
  +
  +
=== Comments ===
  +
Comments inside of <code><nowiki><includeonly></nowiki></code> tags can be provided between <code><nowiki><!--</nowiki></code> and <code><nowiki>--></nowiki></code>.
  +
  +
Note: You might see a lot of these in existing templates, at the beginning and end of each line. White space can do strange things in templates, and so it is best to eliminate unnecessary white space by putting it inside of comments. One notable exception is inside tables, between the <code>|-</code> and the first cell <code>|</code>, which means the infobox {{t|row/kv}} (et al) can be nicely spaced without consequence.
  +
  +
  +
{{help
  +
|title=New Editor's Guide
  +
|prev=[[Help:Categories|Categories]]
  +
|this=Templates
  +
|next=[[Help:What now?|What now?]]
  +
}}

Latest revision as of 15:47, 23 February 2023

Contents | Getting Started | Guidelines | Markup | References | Images | Categories | Templates | What Now?

Templates make more complicated and repetitive editing tricks easier to do. This page will explain how to create and use them. For more details, see Wikipedia's Help page on Templates.

Using Templates

Most templates that you may need to use already exist, so let's talk about using them first.

Templates are enclosed by double curly braces ({{ and }}). The template name comes first, followed by parameters, all separated by vertical bars (|). It looks something like this: {{name|param1|param2|param3}}.

Note that some templates are entered in a single line of text, like the example above. This is common for reference templates and those which don't require any parameters. However, it is not uncommon for templates to span multiple lines, for the sake of clarity. Something more like:

{{name
|param1
|param2
|param3
}} 

Parameters

There are two kinds of parameters: named and unnamed. Named parameters are identified by the name of the parameter while unnamed parameters are identified simply by the order they appear.

Named Parameters
Named parameters require the parameter name and an equals sign (=) followed by your input. If param1 is a named parameter of {{example}}, and you want the input to be "Mistborn", then you will enter {{example|param1=Mistborn}}.
Unnamed Parameters
Unnamed parameters should be completely replaced by your input. If param1 is an unnamed parameter of {{example}}, and you want the input to be "Mistborn", then you will enter {{example|Mistborn}}.

Example

Let's look at an example using the {{character}} template, which is used to create the infobox at the top of articles about characters. It creates a table with information that commonly pertains to characters. The different fields of the table are entered as parameters.

When used in the Kelsier article, this... ...produces:
{{character
|image=Kelsier.jpg
|abilities=[[Allomancy|Mistborn]] 
|spouse=[[Mare]]
|siblings=[[Marsh]]
|titles=Survivor 
|born=c. 984 FE
|world=Scadrial
|ethnicity=Skaa
|residence=Luthadel
|books=[[Mistborn (series)]]
}}
Kelsier
Kelsier.jpg
Family
Spouse Mare
Siblings Marsh
Born c. 984 FE
Abilities Mistborn
Titles Survivor
Ethnicity Skaa
Residence Luthadel
World Scadrial
Featured In Mistborn (series)

Types of Templates

Let's go over the common types of templates you may encounter and make use of.

Information Boxes

Called infoboxes for short, these templates create the tables at the upper right hand corner of articles. They display important facts and details which are common to articles of the same category. Infoboxes are placed at the start of the article. There are infobox templates for all of the high level content categories, and a few others that are more specific. Common examples include {{book}}, {{character}}, {{magic system}}, and {{location}}.

For more detailed help on infoboxes in general see Help: Infoboxes and for a full list of infobox templates, see Category: Infoboxes.

Navigation Boxes

Called navboxes for short, these templates create the tables at the bottom of pages that link to other important articles that are related to the same book or series. Most series or standalone books have a navbox that refers to important characters, places, etc. Navboxes are placed at the end of the article, directly after the <references /> tag. Common examples include {{Cosmere}}, {{Stormlight}}, and {{Reckoners}}.

For a full list of navbox templates, see Category:Navbars.

Notices

Notice templates alert users and editors of important information regarding the page itself. Some notable notice templates are listed below. For a full list of notice templates, see Category:Notices.

{{attention}}
Makes note at top of page that article needs attention and categorizes the article accordingly. Place directly after infobox.
{{copyright}}
Asks users not to copy the content on the article.
{{theory}}
Warns that the article or section contains speculation and should not be considered canon. Place directly after infobox or directly after section heading.
{{spoilers}}
Warns that the article contains information pertaining to recently published material that many users may not have read yet. Place directly after infobox.
{{delete}}
Requests that an administrator delete the page.
{{move}}
Requests that an administrator move the page (change the title). An unnamed parameter may be included to indicate which page it should be moved to.
Quality Tags
Quality tags are simple templates that indicate the level of completion/quality of an article and categorize it accordingly. These are discussed in detail on the Help:Categories page and include {{stub}}, {{partial}}, and {{complete}}

Reference Templates

Reference templates are used to cite the source of information in an article. They create a superscript number that links to the footnotes in the "Notes" section, where the full reference is provided. For more on reference templates, see Help:References.

Link Macros

Link macros are templates which link to something that's related to the input. They often categorize the article as well. For a full list of link macros, see Category:Link macros.

Editorial Notations

Editorial notations are used to highlight information which is unsupported, ambiguous, or questionable. For more, see Help:References.

Other Templates

Some other notable templates include the following:

{{b}}
This is a simple template that outputs a full book or series title given an abbreviated or shorthand reference. For example, "{{b|sa1}}" returns "The Way of Kings" (i.e. Stormlight Archive book 1).
{{columns}}
Use the {{columns}} template to create columns. Use {{columns|count=N|TEXT}}, where N is the desired number of columns and TEXT is the content to be split up into columns. Separate items in TEXT by using line breaks or lists. Note that |count=N may be omitted; the number of columns is 3 by default.
This... ...produces:
{{columns|count=2|
* Item 1
* Item 2
* Item 3
* Item 4
* Item 5
}}
  • Item 1
  • Item 2
  • Item 3
  • Item 4
  • Item 5
{{quote}}
Use {{quote}} to highlight some text as a quote. Use {{quote|TEXT|SOURCE}}, where TEXT is the quote itself and SOURCE is the source of the quote (typically the name of the speaker or a short description of the context, followed by a reference). {{quote|Do or do not. There is no try.|Yoda}} produces:

Do or do not. There is no try.

—Yoda
{{sidequote}}

Do or do not. There is no try.

—Yoda
Use {{sidequote}} to place a quote on one side of the page, with text floating around it. Use {{sidequote|TEXT|SOURCE|POSITION|WIDTH}}, where TEXT is the quote itself, SOURCE is the source of the quote, POSITION is the alignment of the quote (left or right), and WIDTH is some number followed by "px", to specify the width of the quote in pixels. When placed at the top of this paragraph, {{sidequote|Do or do not. There is no try.|Yoda|side=right|size=300px}} produces the quote to the right.
{{for}}
This template provides a quick and clean way to refer to other articles. It generally takes one unnamed parameter, {{{1}}}, as input. By default, it returns "For more information, see {{{1}}}", where {{{1}}} is a link to the referenced article. A second unnamed parameter will replace "more information" and a third will replace the text which refers to the linked article. For example, {{for|cosmere|oodles of information|this page about the cosmere}} produces:

Template Pages

Templates are created just like articles and categories: you create a page for one in the Template namespace. You should find documentation for a template on this page. It will provide a description of what the template does, a list of required and acceptable parameters, and occasionally some examples.

Editing Templates

Editing templates (or creating one from scratch) is definitely not a task for beginners. But we'll go over some of the basics.

Includeonly and Noinclude

<includeonly> Tag
Everything you want the template to do when used on other pages should be sandwiched between <includeonly> and </includeonly> tags.
<noinclude> Tag
The template's documentation, and anything else you want to show up on the template page itself, must be sandwiched between <noinclude> and </noinclude> tags.

Parameters

Named Parameters
Named parameters are referred to by their name in triple braces. For example, the named parameter "books" in the {{character}} template is referred to as {{{books}}}.
Unnamed Parameters
Unnamed parameters are referred to by the order they are entered. For example, the first unnamed parameter that is entered in the {{book ref}} template is referred to as {{{1}}}, while the second is referred to as {{{2}}}.
Defaults
Provide a default value for parameters by including a vertical bar (|) followed by the default value. To use a null default value, enter nothing after the vertical bar. For example, if you want the first unnamed parameter to have a default value of "Sanderson", use {{{1|Sanderson}}}.

Parser Functions

There are a number of functions that can be used to generate different results based on the input provided. For an extensive list, see MediaWiki's Parser Functions page. Here are some of the basics:

Uppercasing Text
This function converts a string of text to all uppercase.
Use: {{uc: TEXT}}, where TEXT is the text to be converted.
Example: {{uc: heLLo}} produces HELLO.
Lowercasing Text
This function converts a string of text to all lowercase.
Use: {{lc: TEXT}}, where TEXT is the text to be converted.
Example: {{lc: heLLo}} produces hello.
String Compare
This function compares two strings of text and provides one of two results.
Use: {{#ifeq: A|B|Result1|Result2}}, where A and B are the strings of text. If A=B then Result1 is returned; otherwise, Result2 is returned.
Example: {{#ifeq: dog|dog|same|different}} produces same and {{#ifeq: dog|cat|same|different}} produces different.
If-Then
This function checks if a parameter exists and provides one of two results.
Use: {{#if: A|Result1|Result2}}, where A is some parameter. If A exists (i.e. it isn't null) then Result1 is returned; otherwise, Result2 is returned.
Example: If a second unnamed parameter is provided, {{#if: {{{2|}}}|hello|goodbye}} produces hello. If not, it produces goodbye.
Case-Switch
This function performs a series of string compares until a "true" result is found.
Use: {{#switch: X|A=Result1|B=Result2|C=Result3|etc.|Default}}, where X is compared to A, B, and so on. The first match provides the corresponding result. A final, default result may be provided in case no match is found.
Example: {{#switch: cat|dog=bark|cat=meow|growl}} produces meow and {{#switch: bear|dog=bark|cat=meow|growl}} produces growl.

System Variables

There are a few system variables which provide different values as needed. These are given in all caps between double curly braces. For an extensive list, see MediaWiki's Magic Words page. The two most common are:

Pagename
{{PAGENAME}} provides the name of the page/article. If used in this page it would yield Templates.
Namespace
{{NAMESPACE}} provides the name of the page's namespace. If used in this page it would yield Help.

Comments

Comments inside of <includeonly> tags can be provided between <!-- and -->.

Note: You might see a lot of these in existing templates, at the beginning and end of each line. White space can do strange things in templates, and so it is best to eliminate unnecessary white space by putting it inside of comments. One notable exception is inside tables, between the |- and the first cell |, which means the infobox {{row/kv}} (et al) can be nicely spaced without consequence.


New Editor's Guide
Categories Templates What now?