Modèle:Infobox
Infoboxes are informational summaries of an article's key points. {{Infobox}} allows you to create infoboxes that follow a standard appearance and style with minimal markup. {{Infobox}} is based on the Person and Book infoboxes from the Forgotten Realms wiki.
Usage
{{Infobox | ibname = | ibtype = | image = | website = | pubcode = | ibclass = | bgcolor = | fgcolor = | paramname1 = | param1 = ... | page = {{{page|}}} }}
All of {{infobox}}'s parameters are optional, and except for name do not appear if not passed or are passed with an empty parameter. Most uses of {{infobox}}es should be in templates that pass the necessary parameters to {{infobox}}. See the examples below for more details.
Title and type metadata
- ibname
- The name that appears at the top of the infobox.
- Default: {{PAGENAME}}
- ibtype
- The type of content this infobox summarizes. This is wrapped in parentheses in the rendered infobox.
- image
- An image link that illustrates the article's subject. This should almost always be 250px wide.
- website
- A link associated with the article. This typically appears beneath the image.
- pubcode
- The stock code associated with a product. This typically replaces the default text of the website link.
Style attributes
- ibclass
- The name of a CSS class to associate with the infobox. tantable and infobox are always assigned; any classes added here are added to the infobox and do not override these classes.
- bgcolor
- A CSS color code for the background of the ibname and ibtype parameters.
- Default: #000
- fgcolor
- A CSS color code for the text of the ibname and ibtype parameters.
- Default: #FFF
Parameters
- paramnamen
- The name of a parameter in the infobox, presented in order from top to bottom in the infobox's body. This text is bolded in the left column of the infobox's body. You can include as many paramnamen entries as you wish, but each should be accompanied by a paramn of the same number.
- Certain paramnames have special properties:
- artworkby, imagesof, gallery, worksby: Links the param to a category, either :Category:Artwork by param for artwork by creator, :Category:Images of param for artwork categorized by subject, :Category:Artwork from param for artwork categorized by source, or :Category:Works by param for published works by creator, respectively. Only the param is displayed, only one of these two options should be used, and only one instance of it should be used per infobox.
- Default, if no param is provided: {{PAGENAME}}
- isbn, ISBN, isbne, ISBNE: Precedes the content with "ISBN", triggering special handling of a valid ISBN param.
- regionmap: An image with no preceding text, designed to display a regional map for a location. Only the regionmap's param content is displayed.
- source: Italicized source spanning the infobox body, preceded by a horizontal line and "Source:" and suffixed by a page number if the page parameter is provided. Only the source's param content is displayed, only one source should be used per infobox, and the source should be the last paramname/param in the infobox.
- artworkby, imagesof, gallery, worksby: Links the param to a category, either :Category:Artwork by param for artwork by creator, :Category:Images of param for artwork categorized by subject, :Category:Artwork from param for artwork categorized by source, or :Category:Works by param for published works by creator, respectively. Only the param is displayed, only one of these two options should be used, and only one instance of it should be used per infobox.
- paramn
- The content of the associated parameter, typically displayed as plain text in the right column of the infobox's body unless noted otherwise above.
- page
- A page number for a provided source paramnamen. page only appears if there is a source.
Example
Subject template example
You can create an infobox template that itself calls {{Infobox}}. Indeed, this is the preferred way to use {{Infobox}}—you can create an infobox that employs a reusable, standard set of parameters for a common subject without needing to use complex wiki code or HTML.
{{ #forargs: paramnameInfobox | ||
---|---|---|
(City) | ||
key | value |
}} |
{{Infobox | ibname = {{{name|}}} | ibtype = City | image = {{{image|}}} | bgcolor = #363 | fgcolor = #fff | paramname1 = Titles | param1 = {{{titles|}}} | paramname2 = Nation | param2 = {{{nation|}}} | paramname3 = Region | param3 = {{{region|}}} | paramname4 = Size | param4 = {{{size|}}} | paramname5 = Population | param5 = {{{population|}}} | paramname6 = Demographics | param6 = {{{demographics|}}} | paramname7 = Government | param7 = {{{government|}}} | paramname8 = Alignment | param8 = {{{alignment|}}} | paramname9 = Demonym | param9 = {{{natives|}}} | paramname10 = Adjective | param10 = {{{adjective|}}} | paramname11 = Ruler | param11 = {{{ruler|}}} | paramname12 = Leader | param12 = {{{leader|}}} | paramname13 = regionmap | param13 = {{{regionmap|}}} | paramname14 = source | param14 = {{{source|}}} | page = {{{page|}}} }}
The above example is {{City}}. See that template's documentation for details on its usage. {{City}} passes its content to {{Infobox}} through its own defined parameters.
When creating an infobox template using {{Infobox}}, you can make a parameter always appear by adding a fallback value. For example, to make the region parameter above a required or always-appearing parameter, change its param from {{{region|}}} to {{{region|''required''}}. For more examples, see the {{Book}} template.
Raw infobox example
{{ #forargs: paramnameExample arbitrary infobox | ||
---|---|---|
(Example) | ||
key | value |
}} |
You can also create arbitrary, one-off infoboxes by directly invoking {{Infobox}}.
{{Infobox | ibname = Example arbitrary infobox | ibtype = Example | bgcolor = #FFF | fgcolor = #000 | paramname1 = First | param1 = This text appears first | paramname2 = Second | param2 = This text appears second | paramname3 = artworkby | param3 = Wayne Reynolds | paramname4 = source | param4 = [[Core Rulebook]] | page = 1 }}