Help:Wiki University Wikitext--Templates

From FamilySearch Wiki
Jump to navigation Jump to search




Other Coding Options

Additional Helps

What are templates?[edit | edit source]

According to the Macmillan dictionary, a template is:

  • something that is used as a pattern or an example for something else; like a cookie cutter.
  • in MANUFACTURING: an object made of metal, plastic, or thin board that is used as a pattern for cutting things in the same shape.
  • in COMPUTING: a computer file that copies are made from because its basic form can be used again and again.

In Wikitext, a template is:

  • a unique article containing text, tables, images, or other coded material that can be "embedded" on any page in Wiki.
  • material you want to add to many pages (i.e. use again and again) without having to type or copy and paste coding onto those pages.

NOTE: Whatever is in the template will be the same in each and every article on which you embed the template.

  • To the right is an example of an image template embedded with the wikitext code: {{CommunityTree}}
    A FamilySearch Community Tree is available for this place.
  • Below is an example of a table template embedded with the wikitext code: {{Exper1}}
Healthy Foods
Foods with short shelf life Foods with long shelf life
Fruits Vegetable Nuts Grains
Apples Peas Peanuts Wheat
Pears Carrots Walnuts Oats
Cherries Corn Cashews Barley
Orange Beans Almonds Buckwheat

How to create a template[edit | edit source]

Templates are created by an Administrator or their designate.

To create a "new template", the Administrator will:

(1) go to the Wiki Search box and type in the following:
Template:Template name
(2) he or she will then "add" the desired coding (text, table, image, or other) into the coding area and "save" the template.

  • NOTICE the word Template must be followed by a colon. If the word template and its colon are missing, an "ordinary article", not a template, will be saved.
  • NOTICE the "Template name" is user-defined and must be unique to Wiki, meaning the name should not already exist in Wiki.
  • IMPORTANT! If you are assigned by an Administrator to create a template and desire to practice, please follow the creating/saving instructions found below under the heading "Restrictions on template creation and embedding".

How to embed a template[edit | edit source]

Anyone can embed a template anywhere on a page.
To embed a template, type the following code on the page you want the template to appear:

{{Template name}}

  • NOTICE you do not type the word template with the colon between the curly brackets. You type only the name you gave the template.
  • NOTICE if you were to click on "Edit source" in the tool bar to see the coding for the template, you will only see the curly brackets, and the name of the template, not the coding that was used to create the template.


To find all the templates embedded on a page, click the "Edit source" tab in the tool bar and then go down below the edit box. There you will see a complete list of all templates on the page. This will include all sub templates that may be part of the ones actually seen on the page. Many templates have templates in them as well, which can make following the code very difficult.

  • NOTICE to see the coding of a template, you need to click on the template name in the list below the edit box and then click on "Edit source."

Editing templates[edit | edit source]

  • Editing a template is just like editing an article. Go to the template by typing "template:name of template" exactly like you saved it. Then edit as normal.
  • This is important to understand: Whenever you edit a template, those changes will show up on "every page" on which that template is embedded. This can be good or it can be a problem.
>This is a good thing if it is a template that needs updating from time to time. This saves you from having to go to every page the template is embedded to edit it.
>This can be a problem because if you want to update one particular template on a specific page and not all of them, you can't.

Editing only one embedded template[edit | edit source]

  • There may be occasions where you desire to change a template on only one article without impacting other articles that contain the same template.
  • To do so, use the following code to embed the template:
{{subst:Template name}}

  • Steps to take when using "subst:" include:
  1. ENTER the template onto a page using the subst: format above, then SAVE the page.
  2. EDIT the source code on the page. (NOTICE what you see is the wikitext coding used to create the template. It replaces the template on that page.)
  3. MODIFY the coding to your specifications, then SAVE the page.


The word "subst" and the colon before the name of the template allows the template to be embedded in the article with the ability to be edited and only show up on the page it is embedded in. This is very useful if you are going to create many pages using the same format but want the ability to customize a page after it is created without changing the other pages using that template.

Limiting size of templates[edit | edit source]

  • Templates are limited in size in the code of the template. So if you want the template to only be so many pixels wide you have to put that in the code of the template. You can't adjust it while embedding it.

Restrictions on template creation and embedding[edit | edit source]

Currently there are hundreds of templates in use on the Wiki pages. To assure that templates created "for use" on the Wiki pages are distinguished from those created "for practice", the following policy will apply:

1. CREATE and SAVE a new page with the following title:

Template:your username/sandbox/Template name
  • NOTICE: after the word Template, we are adding "your username", a slash, the word "sandbox", and another slash as part of the template name.

2. EDIT the new page with the text, table, or image you want in the template, then SAVE. For this example, we will enter the following text:


3. Test the template by EMBEDDING it in another sandbox using your template name, in the following format:

{{your username/sandbox/Template name}}
  • NOTICE: when embedding, the word "Template" and the "colon" are removed from the title and the remaining title is enclosed within curly brackets.

Try these out[edit | edit source]

  • Embed the template named 'Gotoarrow' into your sandbox.
  • How would you embed the template named 'Exper1' into your sandbox if you wanted to modify the code for ONLY ONE sandbox?

Quick Quiz
  • Templates are easy to change.
A. True
B. False
  • Change the template and wherever it is embedded is changed as well.
A. True
B. False
  • There is no way to change a template without changing it wherever it is embedded.
A. True
B. False