A template is an element that can be reused in many pages.
Templates can be complicated but are invaluable to:
- Reuse elements in multiple pages (e.g. Template:Button, Template:References needed)
- Give a standard format to elements (e.g. Template:Video, Template:Header, or Template:Item)
- Display notices on pages that notify users or help maintain pages (e.g. Template:Notice, Template:Delete)
- Insert elements whose behavior can be programmed according to some variables (e.g. Category:Databox templates).
You can see all available templates at Category:Templates.
How to add a template to a page[edit | edit source]
- Edit the page
- Go to the place where you want to insert the template
- Click Insert and then Template
- Search for the desired template
- Fill out any required or desired parameters
- Click Insert
- Save the changes
- Edit the page with the source editor
- Go to the place where you want to insert the template
- Write the name of the desired template between curly braces, like so:
{{Name of the template}}
- Add any necessary or desired parameters, like so:
{{Name of the template|param1=value}}
- Save the changes
How to edit an existing template[edit | edit source]
Warning! Editing a heavily used template can damage numerous pages, as well as overloading the servers, which have to update all the pages that include it. For this reason, some high-use templates are protected. Consider discussing any changes to important templates with the community before doing them.
- Go to the template page in the Template namespace, for example Template:Color
- Edit the page (templates can only be edited with the source editor)
- Do your changes
- Preview your changes in a page that uses the template (see below the Save button)
- Save the changes
How to create a new template[edit | edit source]
Templates live in the Template namespace, meaning that they have titles that start with the "Template:" prefix (e.g. Template:Button). Depending on its objective, you can either transwiki them from other wikis such as Wikipedia, or program its functionality from scratch. It's always a good idea to insert the categories to which the template belongs when you're creating a template, a short instructional text, and a presentation of the template functions between certain tags. The actual template code needs to be wrapped within <nowiki></nowiki> tags, to prevent a meaningless result from being shown on the template page itself.
How to transclude pages other than templates[edit | edit source]
You can also transclude pages other than templates by simply including the appropriate namespace. For example:
{{Help:Templates}}
will transclude this page. To transclude pages in the main namespace, prefix a colon like so:
{{:Bicycles}}
That being said, you can usually get better results using Template:Excerpt.
See also[edit | edit source]
- Category:Templates - Main category for all Appropedia templates
- Wikipedia:Help:Template for a more lengthy article on templates
- Wikipedia:Template namespace