Wikipedia:Infobox templates
From Freepedia
An infobox template is an infobox that uses the template software feature.
Like static infoboxes, they are designed to present summary information about an article's subject, such that similar subjects have a uniform look and in a common format. However, the template technique allows updates of style and of common text from a central place, the template page.
These boxes are designed to be placed into main articles related to the topic area, and are usually associated with on-going WikiProjects. They have parameters; to work properly, the parameter values have to be specified when the template is inserted in the page. This allows each infobox to show information relevant to the article subject, while requiring only a minimal amount of coding within each article.
Contents |
Design and usage
The recommended process for creating an infobox template is to begin simply, and gather as many requirements as possible. It is highly suggested that the base format for a new template be tested as a static table first, then, once consensus is reached, moved into template format. It should be reviewed before being heavily used in articles to minimize re-work, in case the template or defined parameters, require modification. If new fields and parameters are added, then articles must be updated to reflect the new requirements. If parameters are renamed or removed, then many articles will likely be unaffected, since extraneous parameters are ignored.
For consistency the following rules apply:
- Standard suggested width of 300 pixels or 25 ems (300px or 25em in CSS).
- Inserted at the top of the article, and aligned to the right side. Using
class="infobox"is a good start. - The top line should be reasonably bold, and contain the full (official) name of the item. This does not need to match the article's Wikipedia title. It should not contain a link. Avoid {{{PAGENAME}}} as pages may be moved for disambiguation.
- Name the template [[Template:Infobox Somesubject]] (Somesubject should be in the singular).
When creating a new infobox template, the content of Template:Infobox is a convenient starting point.
Parameters can be named or numbered; they are usually named.
A parameter value can contain images (i.e. full image tags), or there can be parameters for parts of an image tag such as the image name, the size and the caption. In the latter case, if an image is not applicable or available, use a dummy image such as Image:No image.png.
Similarly, a parameter value can contain links, including piped links (i.e. full link tags), or there can be parameters for parts of a link tag such as the link target and the link label. However, except with a special technique (see m:Template:Lop), in the latter case the link target and the link label have to be specified both, even in cases where they are the same.
Rules for the template calls:
- Insert the primary template starting as the first line of the article. This can be followed by secondary templates.
- Except in the heading, links can be used, both in the constant and in the variable texts.
If any parameter is not applicable, or no information is available, it must still be assigned a value; this can be the empty string, or, if it is the only thing in a table cell, use "some_field= ". The field will appear blank; the code is needed by some browsers for drawing the lines of the table itself properly.
Alternatively, there are ways to have a template change what it displays based on the parameter values it is given:
- If you know CSS well, you can include inline classes in your template, and use parameters to set table rows or cells to those classes.
- There are decision-making templates, like {{If_equal}}, which can test the values of parameters and call further templates based on the results.
- For an example and explanation of how this is done, see {{Infobox_river}}, which omits the table row for an image and caption if the image parameter is left blank.
- Before experimenting with this, you should understand this guideline.
Interaction between multiple templates
Templates can be designed in a modular way, such that various combinations are possible. A combination may even appear on the page as a single infobox.
For example, if the WikiProject Saints group wanted to design a template based on their static Infobox, they could use Template:Infobox Biography, and design a project-specific template with only additional information, and the pages would render both "stacked" together.
List of templates
In many cases, to view a template properly, one has to look at the wikitext also. Therefore below the edit pages are linked. For viewing templates it is convenient to set the preferences to "Show preview on first edit".
The backlinks show the pages with the infobox.
Below, first the primary templates are listed; they are designed to provide high-level information appropriate to a broad subject area.
Industry
| Name | Where to use | Associated WikiProject | |
|---|---|---|---|
| Template:Infobox Company (talk, links, edit) | Business organization articles | Companies |
Anthropology and culture
| Name | Where to use | Associated WikiProject |
|---|---|---|
| Template:Ethnic group (talk, links, edit) | Ethnic groups | Ethnic groups |
Geography
Astronomy
Chemistry
| Name | Where to use | Associated WikiProject |
|---|---|---|
| Template:Chembox (talk, links, edit) | Full chemical compound articles | Chemicals |
| Template:Chembox simple organic (talk, links, edit) | Starting organic compound articles | Chemicals |
| Template:Chembox simple inorganic (talk, links, edit) | Starting inorganic compound articles | Chemicals |
People
| Name | Where to use | Associated WikiProject |
|---|---|---|
| Template:Infobox baseball player (talk, links, edit) | Articles about professional baseball players | Baseball |
| Template:Infobox tennis player (talk, links, edit) | Articles about professional tennis players | Tennis |
| Template:Infobox Biography (talk, links, edit) | Articles describing people (living or deceased) | Biography |
| Template:Infobox Politician (talk, links, edit) | Politician articles in place of Infobox Biography | none |
| Template:Infobox Pope (talk, links, edit) | Popes in place of Infobox Biography | None |
| Template:Infobox President (talk, links, edit) | U.S. Presidents in place of Infobox Biography | None |
| Template:Infobox Playboy Playmate (talk, links, edit) | Playboy Playmates in place of Infobox Biography | None |
| Template:Infobox Senator (talk, links, edit) | Senator in place of Infobox Biography | None |
| Template:Infobox UNSecGen (talk, links, edit) | UN Secretary General in place of Infobox Biography | None |
| Template:Ethnic group (talk, links, edit) | Articles about ethnic groups etc | Ethnic groups |
Fiction
Media and Journalism
| Name | Where to use | Associated WikiProject |
|---|---|---|
| Template:MediaProjectTemplate (talk, links, edit) | Project internal template | Media Project templates |
| Template:Journalism (talk, links, edit) | Journalism articles | Journalism Project |
Transportation
| Name | Where to use | Associated WikiProject |
|---|---|---|
| Template:Airline infobox (talk, links, edit) | Airline articles | Airlines |
| Template:Airport infobox (talk, links, edit) | Airport articles | Airports |
| Template:routeboxca2 (talk, links, edit) | California State Route articles | California State Highway Project |
| Template:routeboxwa (talk, links, edit) | Washington State Route articles | Washington State Highway Project |
| Template:routeboxKY (talk, links, edit) | Kentucky State Route articles | Kentucky State Highway Project |
| Template:routeboxint (talk, links, edit) | U.S. Interstate Highway | U.S. Interstate Highway Project |
| Template:routeboxus (talk, links, edit) | U.S. Highway | U.S. Highway Project |
| Template:Infobox road (talk, links, edit) | Roads | |
| Template:Infobox rail (talk, links, edit) Template:Infobox SG rail (talk, links, edit) | Railroads/Railways (second for standard gauge) | Trains |
| Template:Infobox Rail companies (talk, links, edit) | Rail companies |
Miscellaneous
Secondary templates
These are designed to supplement information provided by primary templates.
| Name | Current text | Where to use (primary template) | Associated WikiProject | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Template:Infobox BPM (talk, links, edit) |
| Articles describing British Prime Ministers (primary template is {{Infobox Biography}}) | Biography | ||||||||
See also
These pages describe other types of templates:
- Wikipedia:Template messages are used primarily to insert simple "boilerplate" messages for Wikipedia maintenance or editing purposes.
- Wikipedia:Navigational templates are article footers designed to provide links to several related articles.
- Wikipedia:MediaWiki interface messages are reserved for internal system use, and can only be modified by administrators.



