Difference between revisions of "Help:Template"

From ArchWiki
Jump to: navigation, search
m (Consistency)
(Frequently used templates: merge Category:Template here)
Line 78: Line 78:
 
To begin the creation process, simply visit [[:Template:Template Name]] (substituting {{ic|Template Name}} with the desired name of the template), [[Help:Editing|edit, and add the relevant wikitext]].
 
To begin the creation process, simply visit [[:Template:Template Name]] (substituting {{ic|Template Name}} with the desired name of the template), [[Help:Editing|edit, and add the relevant wikitext]].
  
== Frequently used templates ==
+
== List of templates ==
Some of the templates most frequently used on the Arch Wiki are listed below. Click on the links to see their detailed usage. For a complete list see [[Special:MostLinkedTemplates]], for a list of all Templates see [https://wiki.archlinux.org/index.php/Category:Template Category:Template].
+
The templates that users can use directly in articles on the ArchWiki are listed below. Click on the links to see their detailed usage. For a list that also includes localizations and meta templates see [[Special:AllPages/Template:]], [[Special:PrefixIndex/Template:]] or [[Special:MostLinkedTemplates]].
  
=== Text boxes ===
+
===Sandbox===
* [[Template:Note|<nowiki>{{Note|This text should be noted.}}</nowiki>]]
+
* [[Template:Warning|<nowiki>{{Warning|This text should be heeded.}}</nowiki>]]
+
* [[Template:Tip|<nowiki>{{Tip|This text should be considered.}}</nowiki>]]
+
  
=== Code formatting ===
+
{{Warning|Please do not experiment with existing templates. If you want to edit a template, copy the text to [[Template:Sandbox]], edit and test it there, and copy it back when it works.}}
* [[Template:ic|<nowiki>{{ic|Inline code}}</nowiki>]]
+
* [[Template:bc|<nowiki>{{bc|Block code without header}}</nowiki>]]
+
* [[Template:hc|<nowiki>{{hc|Block code with header}}</nowiki>]]
+
  
=== Other ===
+
* [[Template:Sandbox]]
* [[Template:Pkg|<nowiki>{{Pkg|package}}</nowiki>]]
+
 
* [[Template:AUR|<nowiki>{{AUR|package}}</nowiki>]]
+
===Protected templates===
* [[Template:Linkrot|<nowiki>{{Linkrot|yyyy|mm|dd}}</nowiki>]]
+
 
 +
These templates are widely used and are thus protected against editing. Please feel free to use them where applicable or suggest modifications on discussion pages.
 +
 
 +
{{Note|If you find a non-protected template that is not a member of the Template category, '''edit it''' and correct this oversight. See the [[Templatetemplate]] template for details.}}
 +
 
 +
====Article status templates====
 +
 
 +
* [[Template:Accuracy]]
 +
* [[Template:Bad translation]]
 +
* [[Template:Deletion]]
 +
* [[Template:Expansion]]
 +
* [[Template:Merge]]
 +
* [[Template:Moveto]]
 +
* [[Template:Out of date]]
 +
* [[Template:Poor writing]]
 +
* [[Template:Stub]]
 +
* [[Template:Translateme]]
 +
 
 +
====Related articles templates====
 +
 
 +
* [[Template:Related articles start]]
 +
* [[Template:Related]]
 +
* [[Template:Related articles end]]
 +
 
 +
====Formatting templates====
 +
 
 +
* [[Template:Message box]]
 +
* [[Template:Progressbar]]
 +
 
 +
===Unprotected templates===
 +
 
 +
====Code formatting templates====
 +
 
 +
* [[Template:ic]]
 +
* [[Template:bc]]
 +
* [[Template:hc]]
 +
 
 +
====Box templates====
 +
 
 +
* [[Template:FAQ]]
 +
* [[Template:News]]
 +
* [[Template:Note]]
 +
* [[Template:Tip]]
 +
* [[Template:Warning]]
 +
 
 +
====Interwiki templates====
 +
 
 +
* [[Template:Wikipedia]]
 +
 
 +
====Miscellaneous templates====
 +
 
 +
* [[Template:App]]
 +
* [[Template:Bug]]
 +
* [[Template:Linkrot]]
 +
* [[Template:Lorem Ipsum]]
 +
* [[Template:Press-entry]]
 +
 
 +
====Package templates====
 +
 
 +
* [[Template:Pkg]]
 +
* [[Template:Grp]]
 +
* [[Template:AUR]]
  
 
==See also==
 
==See also==

Revision as of 08:47, 17 November 2013

Template:Article summary start Template:Article summary text Template:Article summary end

A template is a piece of predefined wikitext that can be inserted into an article. Templates are primarily used to aid in formatting content.

Visit Category:Template for a listing of all available templates.

Usage

Templates are used by adding the following markup to an article:

{{Template Name}}

Most templates take additional arguments, such as Template:Note:

{{Note|This text should be noted.}}

which produces:

Note: This text should be noted.

Some templates use named parameters, such as Template:Hc:

{{hc|head=/etc/rc.local|output=exit 0}}

which produces:

/etc/rc.local
exit 0

The general format is:

{{Template Name|param1|param2|...|paramN}}

See each templates' page for specific usage instructions.

Escape template-breaking characters

There are some characters that, if used inside a template, will break its output: most frequently this happens with = (the equal sign) and | (the pipe sign).

The easiest and most effective solutions to this problem are:

  • Using numbered parameters like in:
Note: This method is effective only with = and is very useful with query strings in URLs, e.g. https://www.archlinux.org/?foo=bar
{{Note|1=This method is effective only with = and is very useful with query strings in URLs, e.g. https://www.archlinux.org/?foo=bar}}
  • Replacing the offending characters with their respective HTML entities, like in:
Note: This method supports all kinds of characters, including =, | and }} ( https://www.archlinux.org/?foo=bar )
{{Note|This method supports all kinds of characters, including &#61;, &#124; and &#125;&#125; ( https://www.archlinux.org/?foo&#61;bar )}}
  • Enclosing the offending characters in <nowiki> tags, like in:
Note: This method displays all kinds of characters ( = | }} ), but completely prevents the wiki engine from processing text markup, like links ( https://www.archlinux.org/ ) and other templates ( {{ic|foo}} ).
{{Note|<nowiki>This method displays all kinds of characters ( = | }} ), but completely prevents the wiki engine from processing text markup, like links ( https://www.archlinux.org/ ) and other templates ( {{ic|foo}} ).</nowiki>}}

Creation

Note:
  • Only create relevant templates. If you are attempting to create a very specialized template that will likely only ever be used on a few articles, please do not bother, avoid cluttering up the templates namespace.
  • Only create concise templates. Remember The Arch Way: Keep It Simple, Stupid!

The following template should be used when creating new templates to ensure that the template is a member of Category:Template and to facilitate usage and editing:

<noinclude>{{Template}}

'''A brief description of the template'''

====Usage====

{{ic|<nowiki>{{Template Name|param1|param2|...|paramN}}</nowiki>}}

====Example====

{{Template Name|param1|param2|...|paramN}}</noinclude><includeonly>Template code goes here...</includeonly>

To begin the creation process, simply visit Template:Template Name (substituting Template Name with the desired name of the template), edit, and add the relevant wikitext.

List of templates

The templates that users can use directly in articles on the ArchWiki are listed below. Click on the links to see their detailed usage. For a list that also includes localizations and meta templates see Special:AllPages/Template:, Special:PrefixIndex/Template: or Special:MostLinkedTemplates.

Sandbox

Warning: Please do not experiment with existing templates. If you want to edit a template, copy the text to Template:Sandbox, edit and test it there, and copy it back when it works.

Protected templates

These templates are widely used and are thus protected against editing. Please feel free to use them where applicable or suggest modifications on discussion pages.

Note: If you find a non-protected template that is not a member of the Template category, edit it and correct this oversight. See the Templatetemplate template for details.

Article status templates

Related articles templates

Formatting templates

Unprotected templates

Code formatting templates

Box templates

Interwiki templates

Miscellaneous templates

Package templates

See also