Template:Media
This is the template documentation for Template:Media.
Purpose
Used to create galleries with tabs in infoboxes, including automatically setting a caption for the image. The template should still be used even if the infobox has only one image. If only one image and caption is set, it will be outputted without the tab formatting.
Usage
Basic Formatting
Media is used in a manner like so:
{{Media
|ExampleFile.png|Example Tab Name
|ExampleFile2.png|Example Tab Name 2
}}
The first parameter begins with a pipe (|) then follows with the filename of the image in question. The second parameter begins with another pipe and sets the name for this tab, which will be associated with that image.
Inside an infobox, Media should look like this:
{{Infobox Example
|image={{Media
|ExampleFile.png|Example Tab Name
|ExampleFile2.png|Example Tab Name 2
}}
For most infoboxes in the majority of cases, such as with Infobox Character and Infobox Demon, the tab name should use the media's abbreviation that the image is sourced from. Using the media abbreviation also generates an auto-caption for the image in question, which can be controlled and modified as-needed. See the auto-caption section below for more information.
By default, the first tab in the list is the one that will be displayed when opening an article; however, the tab list should follow the media order, even if the first tab does not represent the subject of the infobox properly (for example, Jack-o'-Lantern's design in Megami Tensei II). For this reason, Media also allows for a specific tab to be set as the default with the active= parameter. When setting a tab as the default, that tab's name should be used in the parameter, rather than that tab's file, like so:
{{Media
|ExampleFile.png|T1
|ExampleFile2.png|T2
|active=T2
}}
In this example, when loading into the page, the active tab will be T2, rather than the default of T1.
SEO Image
Template:Media will automatically select the first tab's image by default to be indexed by search engines for representing the page. When the active= parameter is used, the active tab's image will instead be indexed.
If in the event that Media's auto-indexed image needs to be overwritten with another, the infobox seoimage= parameter can be used to achieve this, requiring just the full file name. This parameter should otherwise not be included in the infobox when not needed.
Controlling the Auto-Caption
By default, Template:Media generates an auto-caption for the image from the media abbreviation placed in the tab name. Example: "Artwork from (media name)", which is the default auto-caption and the most commonly used caption on the wiki. If an undefined or no abbreviation is used in the tab name, the caption will be rendered as "Artwork from unknown media" and add the page to Category:Pages with links to unknown media. This error can be bypassed, allowing for an unique tab name, with the ~ function, as detailed further below. To change the Artwork file type in the auto-caption, see the type parameter below.
To control aspects of this auto-caption, Media uses three appended symbols as shorthand functions: +, -, and ~, which are to be placed immediately following the tab name. The first instance of any of these symbols followed by a text string will produce different effects, as defined below. If Template:Media is also using the active= parameter, ensure that the entire content of the tab name (both functions and text string) is identical.
If in the event that a plus sign, hyphen, or tilde needs to be added to a caption, +, ‐, or ˜ can be used in place of the symbols.
+ Function
+ will define the media type of the abbreviation given, intended for images that are sourced from non-game media. When unset, the auto-caption will default to 'game' and does not explicitly display the media type in the tab name or caption. + therefore must be used for non-game media in order to properly display the auto-caption; otherwise the caption will display an "unknown media" error. For example: in DeSu2A+TV, the tab name would add the media type in small text parentheses, and the caption would display the media type in the respective link. Even when the infobox has only one image and tab, this function can still be used to control the output of the media link in the caption.
As an example, usage of + would look like:
{{Media
|SMT3 Black Frost Artwork.png|SMT3
|DeSu2A Black Frost Artwork.png|DeSu2A+TV
}}
Artwork from Shin Megami Tensei III: Nocturne
Artwork from Devil Survivor 2 The Animation (TV Series)
- Function
- is used to add a descriptor to the beginning of the auto-caption, intended when the file type (such as artwork) requires one for clarification. For example: in P3R-Battle, the tab name would have the descriptor of 'Battle' in small text, and the auto-caption would be rendered as "Battle artwork from Persona 3 Reload." Even when the infobox has only one image and tab, this function can still be used to control the output of the caption's descriptor.
As an example, usage of - would look like:
{{Media
|P3R Protagonist Artwork.png|P3R
|P3R Protagonist Battle Artwork.png|P3R-Battle
}}
Artwork from Persona 3 Reload
Battle artwork from Persona 3 Reload
~ Function
~ will overwrite the auto-caption, intended for when an entirely different caption is needed or when a caption would be unnecessary. When used, the auto-caption is disabled and the string of text following ~ is set as the caption instead. ~ is particularly useful in situations where you want to utilize infobox tabs, but not for media abbreviations, as in a page whose infobox contains a map with floor labels, or tabs with a set of company logos from different time periods. An instance of ~ with no text will entirely disable the caption.
For a single image, ~ can be used to set just the caption as well. For example: in {{Media|LB3 Terra Overworld Map.png|~Overworld map}}, the tab abbreviation is unset in the second parameter, but the use of ~ still overwrites the caption.
~ can also be used in conjunction with other functions in order to modify the tab name without using an auto-caption. For example: DeSu2A+TV-Descriptor~Test caption, the tab name would display PDN with both the media type in small text parentheses and the word 'Descriptor' in small text, while the caption would be changed to "Test caption."
As an example, usages of ~ would look like:
{{Media
|No Image.png|No Caption~
|No Image.png|Caption~This is a different caption
|No Image.png|PDeSu2A+TV-Descriptor~Test caption
}}
Type Parameter
In addition to these shorthand functions, the file type displayed in the auto-caption (Artwork by default) can be changed for all images in the infobox using the type= parameter, as in type=Map which changes every instance of "Artwork" in the auto-captions to "Map." As an example, this would look like:
{{Media
|type=Map
|LB2 GBC Terra Overworld Map.png|LB2
|LB3 Terra Overworld Map.png|LB3
}}
Map from Last Bible II
Map from Last Bible III
For individual images that do not match the specified type, the auto-caption can still be overwritten entirely with ~. This would look like:
{{Media
|type=Model
|SH1 Gungnir Artwork.png|SH1~Artwork from {{Link|Game|SH1}}
|P3F Gungnir Model.png|P3F
|P3R Gungnir Model.png|P3R
|P5R Gungnir Model.png|P5R
}}
Artwork from Devil Summoner: Soul Hackers
Model from Persona 3 FES
Model from Persona 3 Reload
Model from Persona 5 Royal
Code
- Minimal code
{{Media
|FileName.png|TabName
}}
- All parameters
{{Media
|type=
|FileName.png|TabName
|active=
}}