Help:Templates
Our MEpedia software includes both regular pages, and template pages, which are designed to be embedded inside regular pages. Embedding one page inside another page is called transclusion. Note that template pages are very different from templates in the usual sense of the word.
What do template pages do?[edit | edit source]
A template page can contain a standard message, perform calculations, add extra formatting, call special programming code, (e.g. to categorize pages) and perform complex functions that change the way a page works. Template pages can be used to add the same content to multiple pages - some of that content may be hidden and some may be extremely complex.
Template pages vs. Template tags[edit | edit source]
You will probably never have to edit or create template pages, but you will need to use them indirectly when you are editing regular pages. You might have already used template pages without realizing it, by embedding a "template tag" into a page. In the Visual Editor, a template tag often appears as a puzzle piece () or a box that you have to click on to edit. In the Source Editor, a template tag will appear as double braces {{ }}
enclosing the name of a template page. For example, {{stub}}
embeds the stub template into a page.
What do template tags do?[edit | edit source]
Template tags can be inserted into a page to signify many different things: that a page is a stub, that a page needs a cleanup, that a statement needs a reference, etc. The tables below list the template tags that are used at MEpedia, and briefly explain what they do.
How to add a template tag to a page[edit | edit source]
To insert a Template tag in the Visual Editor, see MEpedia's Visual Editor guide.
To insert a Template tag in the Source Editor, see MEpedia's Source Editor guide.
Common templates[edit | edit source]
Most commonly used by editors[edit | edit source]
The following table lists the most important templates you may need to use.
Template name | Description / Function | Advanced (source) editor code |
---|---|---|
Citation needed | Indicates facts that require citations. |
{{Citation needed|reason= |date= }}
|
Stub | Indicates a very short article that is a "stub" waiting to be expanded. |
{{Stub}}
|
Cleanup | Indicates articles that need cleanup and the reason why. |
{{Cleanup|reason= |date= }}
|
Reference pages (or Rp) | Specify specific page number(s) after a citation. |
{{Reference pages|page= }} or
{{Rp|page= }}
|
Reference list (or Reflist) | Produces a list of references at the end of an article. Identical to <references/> , but with additional style formatting.
|
{{Reference list}} or
{{Reflist}}
|
Less commonly used by editors[edit | edit source]
The following table lists template tags advanced editors may need to use.
Template name | Description / Function | Advanced (source) editor code |
---|---|---|
Message box (or Mbox) | Displays a user-friendly information box with a custom message. |
{{Message box|text= }} or {{Mbox|text= }}
|
Glossary entry (created specially for MEpedia) | Adds a glossary entry to the Glossary, in a format to support pop-up definitions on pages. Should be immediately followed by a citation. |
{{Glossary entry|name=Biopsychosocial model|abbreviation=BPS|definition=a school of thought, usually based in psychology, which claims illness and disease to be the result of the intermingling of biological, psychological and social causes.|synonym1=biopsychosocial model|synonym2=BPS|synonym3=Biopsychosocial|synonym4=biopsychosocial}}
|
Glossary see other entry (created specially for MEpedia) | Adds a glossary entry that refers to another glossary entry. |
{{Glossary see other entry|name=BPS|othername=Biopsychosocial model}}
|
Infobox book | Adds an informational table to a page about a book. |
{{Infobox book| name= | image= | caption= | author= | illustrator= | cover_artist= | country= | language= | subject= | genre= | publisher= | pub_date= | media_type= | pages= | isbn= | website= }}
|
Bookmark (or Shortcut) | Displays a small reminder box at the target location of a redirect, when the redirect points to a specific location within a page. |
{{Bookmark|redirect_page}} or {{Shortcut|redirect_page}}
|
NeedsImage (created specially for MEpedia) | Mark an article as needing a photo or image adding to it. Adds it to the category Category:Articles that need an image or photo. |
{{NeedsImage}}
|
Disambiguation | Mark a page as being a disambiguation page, linking to two or more articles that a word or term may refer to. |
{{Disambiguation}}
|
Done | Displays a check-mark with the word "Done" in bold font. |
{{Done}}
|
Collapse top / Collapse bottom | A pair of templates that, when used together, hides a section of a page temporarily. Users can click "expand" or "show" to reveal the hidden section. | {{Collapse top|title= }} ... {{Collapse bottom}}
|
Main article (or Main) | Links a section of one page to the full article concerning that section. |
{{Main article|page_name= }} or {{Main|page_name= }}
|
See also | Links a section of one page to a article relevant to that section. |
{{See also|page_name|display_text_for_page}}
|
Dead link | Marks an external link as no longer functional. |
{{Dead link|date= }}
|
Clear | Provides extra clear space, if needed, to ensure that the previous text and its accompanying image stay together. It is often used to prevent the following text from flowing alongside the previous, unrelated image. |
{{Clear}}
|
Important templates used behind the scenes[edit | edit source]
Users generally don't need to know about these templates, although they are used indirectly.
Template name | Description / Function | Advanced (source) editor code | Current status | Visual editor (TemplateData) status |
---|---|---|---|---|
Citation | Creates a CS2-style citation, with inline superscript and corresponding footnote. | {{Citation|...}} (see template for full syntax)
|
Installed, but needs regular updating to keep up with Citoid changes. | Fully integrated into Visual Editor, with both automatic entry and manual entry with TemplateData. |
Cite (Cite web, Cite news, Cite book, Cite journal, Cite tweet) | Creates a CS1-style citation, with inline superscript and corresponding footnote. | {{Cite ...}} (see templates for full syntax)
|
Installed, but needs regular updating to keep up with Citoid changes. | Fully integrated into Visual Editor, with both automatic entry and manual entry with TemplateData. |
PagesInCategory | Automatically displays all of the articles within the specified category |
{{PagesInCategory|category-name}}
|
This template tag was custom-written for MEpedia, and depends upon the DynamicPageList/Intersection extension. | No TemplateData needed. |
CategoriesInCategory | Automatically displays all of the sub-categories within the specified category |
{{CategoriesInCategory|category-name}}
|
This template tag was custom-written for MEpedia, and depends upon the DynamicPageList/Intersection extension. | No TemplateData needed. |
AllPagesHeaderTemplate | Allows a banner to be placed at the top of content pages. Automatically added to the top of pages by the PageNotice extension, via interface messages named "MediaWiki:Top-notice-ns-*". | N/A | Template created for MEpedia. Interface messages defined for each namespace. | N/A |
AllPagesFooterTemplate | Specifies a medical disclaimer. Automatically added to the end of all pages by the PageNotice extension, via interface messages named "MediaWiki:Bottom-notice-ns-*". | N/A | Template created for MEpedia. Interface messages defined for each namespace. | N/A |
FundraisingSiteNotice | Specifies a fundraising dismissable site notice to be displayed at the top of the screen during the month of December. | N/A | Template created for MEpedia. | N/A |
Welcome | Specifies an introductory message for new users. Displayed after new account creation and linked to from the welcome notice. ("notices" at the top of the screen) | N/A | Template created for MEpedia. | N/A |
Protected | Specifies a formatted message for users trying to edit a protected page, but can't. | N/A | Template created for MEpedia. | N/A |
License templates | A set of templates to be added to files when they are uploaded by Special:Upload, as specified in MediaWiki:Licenses. Each type of copyright license has its own template. | N/A | Templates installed. | N/A |
How to integrate a new template page into the Visual Editor[edit | edit source]
A new template page is often copied from www.mediawiki.org
or from similar sites. Often, the new “Template:” page is copied along with other pages, such as a “/doc” subpage that contains documentation for the new template page. For more information on copying new template pages from Wikipedia, see MediaWiki’s manual page on the subject.
If you want the new template page to be accessible from the Visual Editor, you must first define the “TemplateData” for the template page. Often, this TemplateData is found in the “/doc” subpage. If you edit the TemplateData in the main “Template:” page, and see a warning that “There is a related TemplateData block on the /doc page”, it just means that the TemplateData has already been defined in the /doc subpage. Due to a bug in our software version, this TemplateData must be moved to the main “Template:” page instead. (See here) For more information on TemplateData, see MediaWiki’s TemplateData help page.