Help:Infoboxes
Infoboxes are tables containing the name of an article's subject, an image and caption, and aggregate data that consists of a summary of the subject. They typically contain quantitative data and information that can be expressed in a short word or expression, presented as a list of fields, while anything requiring more explanation is reserved for the full-text of the body.
Infoboxes are extremely useful in presenting easily-accessible data for a given subject. They could contain, for example:
- Dates: birth, death, years active, (e.g. composer and musician articles), date of publication (e.g. articles on particular musical works), date of creation, existence or common use (e.g. instrument articles).
- Genre, Style, Instruments: For musician, composer and Young Composers member profiles.
- Range: For instruments.
- Type, Family, etc. of instruments (e.g. aerophones, flute family).
- Other examples that don't work for the Young Composers Wiki: Population (cities), casualties (wars, disasters), taxonomical information (living beings).
This, of course, is only a short list of the kind of information you could include in an infobox.
For example, on the Young Composers member profiles, we use them to list username, date of birth, place of residence, composition style and history information, and contact information. For an example, see Profile:Marc-Alexandre Chan. You could also look up any famous person's name, an animal's name, or the name of any movie, book, television show, etc. on Wikipedia and find more examples of infoboxes.
Infoboxes | |
This is the image's caption. | |
Field 1 | Value 1 |
---|---|
Field 2 | Value 2 |
How to make your own infobox
Creating your own infobox is very easy. You should create infoboxes as a template; to do this, create a new article that starts with Template:, e.g. Template:Profile. This makes it usable as a include-able template in articles - the previous example can be included as {{Profiles|(parameters here)}}
. For more information on how to use templates, see Using Templates.
There is a series of four templates that you can use to build a new infobox template:
-
{{infobox header}}
-
{{infobox section}}
-
{{infobox field}}
-
{{infobox footer}}
- infobox header
- This is the first template you should use. It creates the beginning of the infobox, with all the formatting needed, and the title part and (optional) image and caption.
- infobox section
- For long infoboxes, you might want to separate the information in it into sections to organize it better. Use this to create a sub-heading inside the infobox.
- infobox field
- This creates a field in the infobox - i.e. a piece of information in the form of the name of the info and the information itself.
- infobox footer
- This just closes the infobox.
Title of the article | |
This is the image's caption. | |
Section 1 | |
---|---|
Field 1 | Value 1 |
Field 2 | Value 2 |
Section 2 | |
Field 3 | Value 3 |
Field 4 | Value 4 |
An example of a very basic infobox can be seen above on the right side. Another one, to the left of this text, shows a simple infobox with sections.
The first infobox (above right) uses this code:
{{infobox header|image=Clavichord.jpg|caption=This is the image's caption.}} {{infobox field|Field 1|Value 1}} {{infobox field|Field 2|Value 2}} {{infobox footer}}
The second one (left) uses this code:
{{infobox header|name=Title of the article|image=Clavichord.jpg|caption=This is the image's caption.|float=left}} {{infobox section|Section 1}} {{infobox field|Field 1|Value 1}} {{infobox field|Field 2|Value 2}} {{infobox section|Section 2}} {{infobox field|Field 3|Value 3}} {{infobox field|Field 4|Value 4}} {{infobox footer}}
These all contain very basic formatting. For information on the more advanced formatting options, please see the documentation for each template (click the template name in the list at the beginning of this section).
Passing parameters
- Note: If you don't understand how to pass parameters to a template, please see Help:Using Templates.
Of course, these examples all contain hardcoded information. While the field name, section name and formatting information you'll want to hardcode directly into your template (so that it remains consistent for all the copies of the infobox you're making), you'll want each article that uses your infobox to provide its own information for the article name, field values, image and caption. In this case, you can make your infobox template take parameters (named or unnamed), and pass them to the templates listed above.
Let's say you have fields called "Aliases" and "Born" for a simple infobox. If "Aliases" is passed to your template using the named parameter alias, you can use the value of this parameter inside your template with:
{{{alias}}}
However, if the template call didn't pass an alias parameter, this will literally display {{{alias}}}. If you want to give it a default value:
{{{alias|default value here}}}
Now, if alias wasn't passed (or is empty), this will literally display "default value here" (without quotation marks). You could just leave it empty if you want it to display nothing when the value isn't passed:
{{{alias|}}}
Now that you know how to pass parameters from your template to the infobox-builder templates, we can start building this simple infobox. You have the name, image and caption field that you want each article to specify when they use your infobox (note: they/you can also leave name blank; {{infobox header}}
uses the page's name in that case). You also want the alias and born fields.
{{infobox header|name={{{name|}}}|image={{{image|}}}|caption={{{caption|}}} }} {{infobox field|Aliases|{{{alias|}}} }} {{infobox field|Born|{{{born|}}} }} {{infobox footer}}
However, you notice that if the page doesn't specify a value for one of the fields, it doesn't show up in the infobox. You don't mind this - maybe you want this! - for Aliases (after all, not everyone has an alias they go by), but everybody has to be born, so you want the "born" field to appear whether something was passed or not. In that case, instead of using a blank default value for the born parameter, use
. (You could also use the text of your choosing instead; e.g. "Unknown".)
For our simple Infobox template, we have:
{{infobox header|name={{{name|}}}|image={{{image|}}}|caption={{{caption|}}} }} {{infobox field|Aliases|{{{alias|}}} }} {{infobox field|Born|{{{born| }}} }} {{infobox footer}}
Now, you could keep editing this to change the formatting, add sections and more info, etc. If you need any assistance in making your own infobox profile, please post in the Infobox thread on the Wiki forum.