Help:A quick guide to templates

From Wikinews, the free news source you can write!
Jump to: navigation, search

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

Templates are pages in the template namespace. This means any page beginning with "Template:", such as [[Template:Templatename]]. The content of a template can be added to a page by typing {{templatename}}.

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.

Creating and editing templates[edit]

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:.

Once you have made the template, you can add {{templatename}} to the pages you want to use it on.

If the template you want to edit looks like {{expand}}, you would go to Template:Expand to edit it. To get there, type in the URL to your address bar, search for it, or make a link 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.

FAQ[edit]

Can I use a template in more than one project? 
No, if you want to use it on two different language Wikipedias, 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? 
As many as you like, but you can't use the same one more than 5 times.
I edited the template, so why didn't the page it is used on change? 
There are some caching bugs. Refreshing by pressing Ctrl and F5 often helps.
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.

Examples[edit]

Noia 64 apps help index.png
This is a copy of m:Help:A quick guide to templates using Wikinews-specific templates. Don't edit this page, except to replace the contents with the current version of that master page. To make changes applicable on all projects, edit the master page; to change Wikinews-specific content, edit the templates; to make demos work, copy templates to this project, and images to Wikimedia Commons. Please see the history of the master page for author details. Please note that all meta content is licensed under the GFDL. As a result this page is licensed under the GFDL.- Edit this template