Creating templates

If you are creating a number of pages that have standard texts that you want to include, for example subheadings or a message at the top of the page, you may wish to create a template. 

Templates are standard wiki pages whose content is designed to be transcluded (embedded) inside other pages. Templates follow a convention that the name is prefixed with "Template:" besides this, you can create them like any other wiki page.

The simplest use of templates is as follows. If you create a page called "Template:Welcome" with contents:

Hello! Welcome to the wiki.

you'll have created your first template! If you then insert the code:

{{Welcome}}

in any other page, when that page is viewed the text "Hello! Welcome to the wiki." will appear instead of {{Welcome}}. The template content is "transcluded" into the other page, i.e. it is integrated in the page.

You can then insert {{Welcome}} at any point of any page where you wish to welcome someone. Suppose it is used in 100 pages. If you then change the template contents to:

Hi there! Welcome to this wonderful wiki.

and revisit any of the 100 pages where the template was used, you'll see the new text instead of the original one. In this way, you have changed the content of 100 pages without editing them, because the template is transcluded into these pages.

This is the basic mechanism. There are several additional features of transclusion that enrich this mechanism and make templates very useful.

If you wish to edit the template that you have inserted on to each page individually, for instance if you are creating a set of subheadings on a page that will subsequently have different content added on each page, you will need to add the template to the page by inserting the code:

{{subst:name of template}} i.e. {{subst:Condition}}

As you did, it is then good to add it to the templates page so that we can all remember what we named them (I certainly need this reminder!!).