Template:Infobox: Difference between revisions

From EMC23 - Satellite Of Love
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 20: Line 20:


For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:
For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:
<pre>
{{Infobox
| name    = {{{name|{{PAGENAME}}}}}
| image    = {{{image|}}}
| caption1 = {{{caption|}}}


| label1  = Former names
|  data1  = {{{former_names|}}}
| header2  = General information
| label3  = Status
|  data3  = {{{status|}}}
... <!-- etc. -->
}}
</pre>




== Content parameters ==
== Content parameters ==


=== Title ===
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):
; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative.
; above : Text to put within the uppermost cell of the table.
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images.
Examples:
{{Infobox
| name = Infobox/doc
| title      = Text in caption over infobox
| subheader  = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<pre style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| title      = Text in caption over infobox
| subheader  = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</pre>{{clear}}
{{Infobox
| name = Infobox/doc
| above      = Text in uppermost cell of infobox
| subheader  = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<pre style="overflow:auto">
{{Infobox
| name = {{subst:PAGENAME}}
| above      = Text in uppermost cell of infobox
| subheader  = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</pre>{{clear}}
=== Illustration images ===
; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text.
; caption(n) : Text to put underneath the images.


=== Main data ===
{{clear}}
; header(n) : Text to use as a header in row n.
; label(n) : Text to use as a label in row n.
; data(n) : Text to display as data in row n.


== Porting to other MediaWikis ==
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] extension. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.


== TemplateData ==
== TemplateData ==
Line 113: Line 49:
</templatedata>
</templatedata>


==See also==
* [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based
* [[Module:Check for unknown parameters]]
* {{tl|Infobox3cols}}
* {{tl|Navbox}} and {{tl|Sidebar}}
* [[Wikipedia:List of infoboxes|List of infoboxes]]
* [[:Module:InfoboxImage]]
* Maintenance categories:
** [[:Category:Articles which use infobox templates with no data rows]] ({{PAGESINCATEGORY:Articles which use infobox templates with no data rows|pages}})
** [[:Category:Pages which use embedded infobox templates with the title parameter]] ({{PAGESINCATEGORY:Pages which use embedded infobox templates with the title parameter|pages}})
<includeonly>{{Sandbox other||
[[Category:Infobox templates| ]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Templates generating microformats]]
[[Category:Templates that add a tracking category]]
[[Category:Lua-based infobox templates]]
}}</includeonly>


==Tracking categories==
==Tracking categories==
* {{clc|Articles with missing Wikidata information}}
* {{clc|Articles with missing Wikidata information}}

Revision as of 04:26, 27 August 2021

Template:Distinguish Template:Documentation subpage Template:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage[edit]

  1. REDIRECT Template:Template link with link off

Template:Redirect category shell is a meta-template: used to organise an actual {{Infobox sometopic}} template (like

  1. REDIRECT Template:Template link

Template:Redirect category shell).

For [[Template:Infobox sometopic]], template code then looks like this, simplified:


Content parameters[edit]


TemplateData[edit]

Template:TemplateData header <templatedata> {

   "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",

"format": "Template:\n\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true } }, "paramOrder": [ "title" ] } </templatedata>


Tracking categories[edit]