Types of templates
A template is content that can be included on any page without having to re-enter it.
A template can be static content, such as:
- text extracted from Wikipedia for inclusion on a Place or Person page
- a summary of an historical event for inclusion on the pages of multiple people
- portions of Help intended for reuse on various Help pages
- research tips relevant for all Place pages in a specific jurisdiction
- items useful in formatting pages
A template can accept dynamic content, such as:
- the title of a specific page
- the date an action occurred
Dynamic content is provided by the user of the template, and is called a parameter.
Dynamic content allows a template to combine pre-defined text with the dynamic content to do things such as:
- place the page in a specific category
- create a link to another WeRelate page
- create a link to an external page
Template documentation
Each template should have its own documentation on when and how to use it. Find the template (see How can I find a template?) and click on it to see its documentation. Additional documentation exists for some groups of templates (e.g., see the conventions for documenting qualified and indirect relationships).
Templates of note
Templates with broad application
The templates Category and CategorySorted place a page in a category and provide a link to the category (the former accepts a link label different from the category name, the latter doesn't). They are used for a wide set of circumstances, including to identify the military unit a person served in. Thus, before giving up on whether a template exists for a specific situation, it is worth considering if one of these templates will serve.
Wikipedia content
A large number of WeRelate's templates are short extracts of information from Wikipedia, to be included on Place or Person (or other) pages. Their names all begin with "Wp-". These templates should not be manually altered. They are refreshed periodically through automation.
- When using the index to find a template, be aware that there are many Wp- templates to page through before getting to the rest of the alphabet (and there is no way to skip directly to the end of the index). If you don't spot the template you want by the time you get to Wp-, consider browsing the template categories or using search.
Templates useful for constructing other templates
See templates in this category for tools that may be useful in building new templates, such as templates that implement "if" and "if not" logic.
Frequently asked questions
What is a template?
- A template is content that can be included on any page without having to re-enter it. This makes it possible to:
- Reuse content in multiple places while maintaining it in one place.
- Make it easier for users to accomplish certain things (such as creating a link, putting a page into a category, or formatting some text) by providing minimal data and letting the template do the rest.
How can I find a template?
- Many templates have been categorized to make them easier to find. See Category:Templates for categories of templates, some of which have sub-categories.
- Many templates have not yet been categorized. Check this index for a list of all pages in the Template namespace.
- You can also use the Search function (selecting "All" from the Search menu and then changing the Namespace to "Template"). Entering keywords might be more successful than page title, since an exact match is needed on the title.
How do I use a template?
- There are two ways of using a template:
- The normal method is to type {{Template title}}. If the template takes parameters, enter "|" after the title, and then enter parameters, separated by "|". This method displays the most up-to-date template content when the page is in view or preview mode.
- Note that each Template page should have instructions on how to use it. If not, and it is not clear, ask for help on the Watercooler.
- The less common method is using the "Subst" command (see below) to copy the current contents of the template to the page and store them there.
Can I create a template?
- Yes - anyone is allowed to create a template, but before you do so, check to see if there is an existing template that accomplishes what you would like to do. Having multiple templates with the same purpose gets confusing for future users.
How do I create a template?
- To create a template, select "Other Page" from the "Add" menu, change the namespace to "Template", and enter the title of the template that you want to create. This will take you to an empty page. Enter the text of the template and save the page.
Can templates have dynamic text?
- Yes. In wiki language, dynamic text is called a 'parameter'. Follow the instructions at the Mediawiki help pages or at Wikipedia. Note that WeRelate doesn't have all template capabilities installed, such as use of "#if". However, the Ifdef and Ifndef templates allow you to define behavior based on whether a parameter is defined (Ifdef) or not defined (Ifndef).
What is the "Subst" command?
- Ordinarily, templates are edited on the Template page, and all pages containing the template reflect the changes. When a user edits a page containing a template (a "recipient page"), they will only see {{Template title|parameter(s)}}; they will not be able to view or edit the template text on the recipient page.
- The Subst commands makes the template temporary. That is, when the recipient page is saved, the current text of the template is copied onto the recipient page. The recipient page is not connected to the Template page after it is saved. Any future changes to the template will not be updated on the recipient page.
- This is very helpful in applications like our welcome protocol. The Welcome1 message can be edited on its template page as the system changes. Older welcomes containing the "subst" command will not be updated. But, new users will receive the most up-to-date version of the welcome message.
- Use the Subst command as follows {{Subst:Template title}}
Related Pages
|