Difference between revisions of "Help:Template"

From ArchWiki
Jump to: navigation, search
(Creation: Category:Template duplicates other automatic lists of templates listed below)
m (Protected templates: ooops I broke that when pasting, sorry)
Line 89: Line 89:
 
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.
 
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.}}
+
{{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 [[Template:Template]] template for details.}}
  
 
====Article status templates====
 
====Article status templates====

Revision as of 08:57, 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.

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 =, | and }} ( https://www.archlinux.org/?foo=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 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 Template:Template 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