Help:A quick guide to templates

This is a quick overview of templates. Full details can be found in Help:Template and m:Help:Advanced templates.

Templates are pages in the template namespace. This means any page whose name begins with "Template:", such as "Template:foo", can be used as a template. The content of a template can be added to a page by typing while editing the page. When the page is later viewed, is replaced by the content of the page "Template:templatename". If the page "Template:templatename" is later altered, all the pages with in them will change automatically.

Amongst other things, templates are used to add recurring messages to pages in a consistent way, to add boilerplate messages, to create navigational boxes and to provide cross-language portability of texts.

When a template is automatically expanded and appears on a page, it is said to be "transcluded".

Templates are documented (or should be) at their pages. Thus if you want to know how to use a template whose name is "foo" (perhaps because you've seen in the source of an article), then go to "Template:foo". (The documentation itself will usually be located at "Template:foo/doc" but will be transcluded onto the "Template:foo" page.)

Creating, editing and using templates
You start a new template in the same way you would start an article page. The only difference is that its title must start with Template:.

Once you have made the template, you can add to the pages you want to use it on. Every page using this template uses the same boilerplate text, each time a user visits it. When the template is updated, all pages containing the template tag are automatically updated.

Alternatively, you can add to the pages you want to use the boilerplate text on. The system fetches a one-time copy of the template text and substitutes it into the page, in place of the template tag. If anyone edits the template afterwards, pages that used the subst: keyword do not update. Sometimes that is what you want.

If the template you want to edit looks like, you would go to Template:foo to edit it. To get there, type "Template:foo" in the search box (see search), or make a wikilink like Template:foo somewhere, such as in the sandbox, and click on it.

Once you are there, just click "edit" or "edit this page" and edit it in the same way you would any other page. You can add anything you would add to a normal page, including text, images and other templates. Please be aware that your edit might affect many pages, so be cautious.

Parameters
Templates can have parameters. Instead of just the template name, like, a template with parameters will have additional text, separated by vertical bars (|), e.g.  . Here "July" is the value of the first unnamed parameter; "yes" is the value of the parameter "lc". Writing the template page for a template with parameters is more complicated than for a template with no parameters. See Help:Templates.

FAQ

 * How can I find out how to use an existing template? : To see the documentation for the template whose name is "foo", go to "Template:foo".
 * Can I use a template in more than one project? : No, if you want to use it on two different language TechInfoDepots, for example, you would need to create it twice.
 * Are templates case-sensitive? : Yes, except usually the first letter.
 * Can I add parameters? : Yes, see Help:Template for instructions.
 * How many templates can I use in a page? : A lot, but it depends on how they work. (In older versions you could not use the same one more than 5 times). There is a limit on the number of template expansions allowed during the creation of a page. If the templates you put on the page use other templates when they are expanded it's possible to exceed the limit. See WP:UNNEST.
 * I edited the template, so why didn't the page it is used on change? : There are some caching bugs. One way to force refresh is to do edit on the page in which the template appears, and to then click on Save page without having changed anything — there is no need to fill in the Summary field since there will not be any history of this as a change generated. Alternatively, refreshing by pressing Ctrl and F5 often helps.  Another way is add "&action=purge" to the address, like you would for "&action=edit" (e.g., :index.php?title=foo&action=purge).
 * Can I move a template to a new name? : Yes, this works in exactly the same way as normal page moves. When a page called for inclusion is a redirect page, the redirect target is included instead.
 * Can I use a template within a template? : Yes.
 * How do I add a new template?: You start a new template in the same way you would start a normal page. The only difference is that its title must start with Template:. Don't forget to document it so that other editors can use it!
 * Where is the manual for the programming language used to write templates?: The language inside templates is the same language as regular wiki markup, but template writers tend to use the more complex available functions such as #if: statements. See ParserFunctions and see the other "advanced functioning" help pages listed below.

Examples

 * Template:stub: an often used message


 * Template:Biological classification: a template with parameters
 * wikibooks:Template:GeneralChemTOC: a horizontal menu bar
 * Template:Underwater work: a template as a simple table with a picture

TechInfoDepot-specific help

 * Help:Template
 * m:Help:Advanced templates
 * TechInfoDepot:Template namespace