Q-BPM:Categories and Templates

This page shows how to create categories and templates.

Overview of Category
Category is a feature to classify articles. For example, if  is written in an article, that article belongs to "Listed companies of the first section of the Tokyo Stock Exchange category." Placing  at arbitrary place of wiki text makes the corresponding article belong to the specified category. Even though the notation is the same as "a link to a normal article (in the same namespace)," which starts with  and ends with , its behavior is significantly different.

It is possible to make a certain article belong to multiple categories, and it is sometimes said that a category tag is added to an article. In each article, "which categories a certain article belongs to" is enumerated at the place specified by its skin. (In case of MonoBook skin, categories are listed at the bottom of the article.) In addition, "which articles belong to a certain category" is automatically listed in each category page.

Example of Categories

 * "Category: Car Manufacturer/Brand"
 * H: Honda, N: Nissan, T: Toyota, etc.


 * "Category:Newspaper Company"
 * Sub-Category) A: The Asahi Shimbun Company, M: The Mainichi Newspapers, N: Nikkei Inc., S: The Sankei Shimbun, Y: The Yomiuri Shimbun
 * A: Asahi Gakusei Shinbunsha, T: The University of Tokyo Newspaper, etc.

Disambiguation category, " " is often used in order to support efficient article navigation.

Difference from Link
Links to normal articles (links to pages that are not in "Category:" namespace) are written as, but because   is used to "add the corresponding article to the specified category," it can not be used as a link to "a category page listing all articles that belong to the category." A link to a category page is created by placing a colon at the head of the link name, say.

Listing Existing Categories
The list of existing categories can be referred to via Special:Categories

Adding Articles to Categories
In order to add an article named "Questetra, Inc." to a category "Company," " " needs to be written in the edit page of the article "Questetra, Inc."

For example, when editing an article "Activity," one should write as follows.

In addition, technically category tags can be placed at any place in the text being edited, in order to avoid unexpected layout problems and to make the text clearly understandable by other editors, it should be put "just before an inter-language link at the bottom of the page" or "at the top of the page."

How to create Category Pages
If an article adds "a category that does not exist," not-created link (red link) is created in its category part, and that not-created link is linked to the category page.

Unlike normal pages, a category page consists of "editable text" and "list of articles that belong to the corresponding category (and list of sub-categories)," and the latter is generated automatically.

Sub-Categories
If a category tag of Category B,, is added in the category page of Category A, Category A becomes a sub-category of Category B.

For instance, if  is added besides the explanation of the category to the category page of Category:Soccer, Category:Soccer becomes a sub-category of Category:Sports.

Overview of Template
Template is an inclusive feature by which the entire content of "Template Page" is inserted by simply writing  in wiki text. is called "invocation of template." Templates are used in many MediaWiki sites for the sake of consistency in layouts of notes of caution, corrections of links, etc.

Some template can deal with "variables (template variables)." In such a case, the template is "invoked with arguments."

In addition, templates are defined separately by each MediaWiki site, so templates of other MediaWiki sites can not necessarily be used in other sites.

Difference from System Variables
Just like templates, "system variables," magic words including, start with " " and end with " ." However, unlike templates, they can not be arbitrarily modified by editors.

Subst-expansion of Template
When  is used, the entire text in "Template:Template Name" is invoked whenever the article is browsed. However, if  is used, the text in the template at the time of the submission is inserted, and the markup, , disappears.

Use of Non-"Template:" Articles As Template
It is possible to invoke "normal articles," which are not in the namespace "Template:" as template pages. However, in this case, ":" (colon) must be added at the head of the name of the article, say. The other thing to be noted is that the limitation is placed on the size of the file to be invoked.

How to Create Templates
Just like the creation of normal pages, an article named "Template:Template Name" can be created by clicking "not-created links (so called red links)" or "inputting a URL directly." For example, if the same table of contents needs to be displayed in multiple articles, it can be realized by following the steps described below.
 * Create "Template:Table of Contents" (See below.)
 * Put " " in articles that invoke the template (See below.)

In addition, it is strongly recommended that how to use the template etc. should be explained in the note of "Template:Template Name" page so that other editors can easily use the template.

How to Hide A Part of Templates
Basically the entire contents of template pages are inserted upon invocation of templates, but sections between  and   in the templates are not included.

For instance, let the content of a template page " " be as follows.

In this case, "pages that invoke"  are required to belong to "Category:Company." To avoid such a problem, this template must be written as follows.

By doing in this way, only the template page " " belongs to.

On the other hand, "sections to be included" can be specified by placing  and   at the beginning of and end of the corresponding sections respectively. (See below.)

Such features are also useful to "write explanation of template pages" and "to crate inter-language links" in addition to the example shown above.

How to Specify Sections Appear Only on "Pages Invoking Templates"
On the contrary to  and ,   can be used in such a case that a template page itself is not desired to be in a certain category while all pages invoking the template should be in that category.

Modification of Templates and Reflection
Once template pages are modified, "all pages that invoke the template" are updated accordingly. However, there are some exceptions explained below.


 * 1) If categories in a template page are modified, "pages invoking the template" are not added to the corresponding categories. In this case, "submit" button must be pressed after setting "the pages invoking the template" into the edit mode.
 * 2) If links written in a template page is modified, while the changes take effect immediately on "the pages invoking the template," it takes some time until the "back links" in the linked pages are updated.