Community Central
Community Central
(→‎Available Tags: Added theme and theme-source)
Tags: Help rte-source
No edit summary
Tag: rte-source
Line 1: Line 1:
 
[[File:90210-infobox-light.png|thumb|right|A sample infobox]]
 
[[File:90210-infobox-light.png|thumb|right|A sample infobox]]
 
{{beta}}
 
{{beta}}
  +
{{available on request}}
 
 
'''Infoboxes''' are like fact sheets, or sidebars in magazine articles, designed to present a summary of the topic of the page. They present important points in an organized and quickly readable format. The sections of an infobox are usually the same from article to article to create consistency across the wikia. Infoboxes are made with [[w:Help:Templates|templates]].
 
'''Infoboxes''' are like fact sheets, or sidebars in magazine articles, designed to present a summary of the topic of the page. They present important points in an organized and quickly readable format. The sections of an infobox are usually the same from article to article to create consistency across the wikia. Infoboxes are made with [[w:Help:Templates|templates]].
   

Revision as of 18:09, 10 June 2015

90210-infobox-light

A sample infobox

This feature or extension is currently under development - it may be in beta testing on specific communities, but may not be widely available for some time.

Infoboxes are like fact sheets, or sidebars in magazine articles, designed to present a summary of the topic of the page. They present important points in an organized and quickly readable format. The sections of an infobox are usually the same from article to article to create consistency across the wikia. Infoboxes are made with templates.

How to use

You can add an infobox through source mode on an article by copying the syntax on the template's documentation page (found at the bottom of the infobox template's page) and pasting it at the top of an article, changing the words after the equals signs to provide the information needed. For example:

{{infobox character
 | title         = Flowa
 | image         = Example.jpg
 | imagecaption  = Flowa, at rest
 | position      = Legal Secretary
 | age           = 2 months
 | status        = Active
 | height        = 5 inches
 | weight        = 20 grams
}}

Creating new infoboxes

Tutorialinfobox

First, create new template, with any name you like, for example Template:ExampleInfobox. Lets start with infobox base, which is title and image.

<infobox>
 <title source="name"><default>{{PAGENAME}}</default></title>
 <image source="image" />
</infobox>

This wikitext will tell your template to use name and image variables for title and image elements. Additionally you can provide default tag, which value will be used instead when variable is not provided or empty.

Right now we only need fields containing additional information, lets add one.

 <data source="season"><label>Season(s)</label></data>

After adding one last field with source set to first and label to First seen we can invoke template in an article with data to get a working infobox.

{{ExampleInfobox
|name=Eddard Stark
|image=eddard.jpg
|season=[Season 1|1]
|first=[Winter is Coming]
}}

And your template ends up like this:

<infobox>
 <title source="name"><default>{{PAGENAME}}</default></title>
 <image source="image" />
 <data source="season"><label>Season(s)</label></data>
 <data source="first"><label>First seen</label></data>
</infobox>

Styling and Display

The infobox is already styled. It is using your wikia's theme. If you change colors in Theme Designer, the infobox will automatically adjust. If any of the variables is empty, it won't be displayed (unless the default tag is invoked).

Advanced usage

Advancedinfobox

Now, that you have created a simple infobox, you can learn how to use more advanced fields. In this section we are going to build infobox shown on the left.

Building advanced infoboxes

There are three normal key-value fields, then title and image fields. As you can see, the title field is not bound to be a first field, but you can only use the Title field once per infobox.

<infobox>
 <data source="prev"><label>Previous</label></data>
 <data source="conc"><label>Concurrent</label></data>
 <data source="next"><label>Next</label></data>
 <title source="name" />
 <image source="image" />
</infobox>

Next field will let you put a number of fields into group, each of which can be named with header. Remember: fields that are declared but don't have a value won't appear. This rule also applies to group - if none of the fields (excluding header tag) inside any particular group have a value, the whole thing won't show up.

<infobox>
 <data source="prev"><label>Previous</label></data>
 <data source="conc"><label>Concurrent</label></data>
 <data source="next"><label>Next</label></data>
 <title source="name" />
 <image source="image" />
 <group>
  <header>Details</header>
  <data source="conflict"><label>Conflict</label></data>
  <data source="date"><label>Date</label></data>
  <data source="place"><label>Place</label></data>
  <data source="result"><label>Outcome</label></data>
 </group>
</infobox>

And now the hardest of all, comparison tag. It gives you an easy way to compare two forces, especially useful in battle or war infoboxes.

Comparison contains set tags, each of which defines compared values. In header tag you can put name of the compared value. For inside use other fields introduced before, for example data tag.

 <comparison>
  <set>
   <header>Combatants</header>
   <data source="side1" />
   <data source="side2" />
  </set>
 </comparison>

Comparison is done. The final template comes after we add missing tags:

<infobox>
 <data source="prev"><label>Previous</label></data>
 <data source="conc"><label>Concurrent</label></data>
 <data source="next"><label>Next</label></data>
 <title source="name" />
 <image source="image" />
 <group>
  <header>Details</header>
  <data source="conflict"><label>Conflict</label></data>
  <data source="date"><label>Date</label></data>
  <data source="place"><label>Place</label></data>
  <data source="result"><label>Outcome</label></data>
 </group>
 <comparison>
  <set>
   <header>Combatants</header>
   <data source="side1" />
   <data source="side2" />
  </set>
  <set>
   <header>Commanders</header>
   <data source="commanders1" />
   <data source="commanders2" />
  </set>
  <set>
   <header>Strength</header>
   <data source="forces1" />
   <data source="forces2" />
  </set>
  <set>
   <header>Casualties</header>
   <data source="casual1" />
   <data source="casual2" />
  </set>
 </comparison>
 <data source="civilian"><label>Civilian casualties</label></data>
</infobox>

Now we just need to invoke it inside article, and the work is done.

{{Battle
|prev = [[Battle of Fair Isle]]
|conc =[[Siege of Old Wyk]]
|next =[[Siege of Pyke]]
|name =[[Siege of Great Wyk]]
|image =Stannis Great Wyk.png
|conflict = [[Greyjoy Rebellion]]
|date = 289 AL
|place = [[Great Wyk]], the [[the Iron Islands]]
|result = [[Iron Throne]] victory
|side1=[[File:Greyjoy mini shield.png|20px|right|link=House Greyjoy]] [[House Greyjoy]]
|side2=[[File:Baratheon mini shield.png|20px|right|link=House Baratheon]] [[Iron Throne]]
|commanders1 = Unknown
|commanders2 = Lord [[Stannis Baratheon]]
|casual1 = Unknown
|casual2 =  Unknown
}}

Available Tags

All infobox fields should be declared using XML convention, with attributes used for field configuration.

Tag Attributes Child tags Description
infobox theme, theme-source title, image, header, footer, data, group, comparison The tag which holds all others and delimits the scope of the infobox
Usage example:
<infobox>
 <title source="title_source" />
</infobox>

HTML output:

<aside class="portable-infobox">
 <div class="portable-infobox-item item-type-title portable-infobox-item-margins">
  <h2 class="portable-infobox-title">Title</h2>
 </div>
</aside>
data source default, label Standard key value tag
Usage example:
<data source="name">
 <label>First name</label>
 <default>John</default>
</data>

HTML output:

<div class="portable-infobox-item item-type-key-val portable-infobox-item-margins">
 <h3 class="portable-infobox-item-label portable-infobox-header-font">First name</h3>
 <div class="portable-infobox-item-value">John</div>
</div>
label N/A N/A Label tag, can be used only inside other tags, check child tags column for more info. Accepts wikitext.
Usage example:
<label>First name</label>

HTML output:

<h3 class="portable-infobox-item-label portable-infobox-header-font">First name</h3>
default N/A N/A Default tag, can be used only inside other tags, check child tags column for more info. Accepts wikitext.
Usage example:
<default>John</default>

HTML output:

<div class="portable-infobox-item-value">John</div>
title source default Should be used only once per infobox, states infobox title.
Example usage:
<title source="title_source">
 <default>{{PAGENAME}}</default>
</title>

HTML output:

<div class="portable-infobox-item item-type-title portable-infobox-item-margins">
 <h2 class="portable-infobox-title">Page name</h2>
</div>
image source alt, caption, default Image tag, used to insert image inside infobox.
Example usage:
<image source="img_name" />

HTML output:

<div class="portable-infobox-item item-type-image no-margins">
 <figure>
  <a href="/wiki/File:Image.jpg" class="image image-thumbnail" title="">
   <img src="Image.jpg" class="portable-infobox-image" alt="" data-image-key="Image.jpg" data-image-name="Image.jpg">
  </a>
 </figure>
</div>
alt source default Can be used only inside image tag.
Example usage:
<image source="image">
  <alt source="alternative_title">
  <default>Default alt text</default>
  </alt>
 </image>

HTML output:

<div class="portable-infobox-item item-type-image no-margins">
 <figure>
  <a href="/wiki/File:Image.jpg" class="image image-thumbnail" title="">
   <img src="Image.jpg" class="portable-infobox-image" alt="Default alt text" data-image-key="Image.jpg" data-image-name="Image.jpg">
  </a>
 </figure>
</div>
caption source default Can be used only inside image tag.
Example usage:
<caption source="caption">
 <default>Default alt text</default>
</caption>

HTML output:

<figcaption class="portable-infobox-item-margins portable-infobox-image-caption">Default alt text</figcaption>
group N/A data, footer, header, image Used for grouping fields, can provide header for each group. Group won't be rendered (including header) when all fields are empty.
Example usage:
<group>
 <header>Group name</header>
 <data source="value1" />
</group>

HTML output:

<section class="portable-infobox-item item-type-group">
 <div class="portable-infobox-item item-type-header portable-infobox-item-margins portable-infobox-header-background">
  <h2 class="portable-infobox-header portable-infobox-header-font">Group name</h2>
 </div>
 <div class="portable-infobox-item item-type-key-val portable-infobox-item-margins">
  <div class="portable-infobox-item-value">Value</div>
 </div>
</section>
header N/A N/A Header tag denotes the beginning of a section or group of tags.
Usage example:
<header>Header Text</header>

HTML output:

<div class="portable-infobox-item item-type-header portable-infobox-item-margins portable-infobox-header-background">
  <h2 class="portable-infobox-header portable-infobox-header-font">Header text</h2>
 </div>
footer N/A N/A Used for providing any wikitext.
Usage example:
<footer>[[Links]]</footer>

HTML output:

<footer class="portable-infobox-footer portable-infobox-item-margins portable-infobox-header-background portable-infobox-header-font">
 <a href="/wiki/Links" title="Links">Links</a>
</footer>
comparison N/A set Used to aggregate fields into set for comparison purposes.
Usage example:
<comparison>
 <set>
 </set>
</comparison>

HTML output:

<div class="portable-infobox-item item-type-comparison">
 <table class="portable-infobox-comparison">
  <tbody>
   <tr class="portable-infobox-comparison-set"></tr>
  </tbody>
 </table>
</div>
set N/A data, footer, header, image Used to group fields into sets for comparison purposes. Can be used only inside comparison tag.
Usage example:
<set>
 <header>First set</header>
 <data source="data1" />
 <data source="data2" />
</set>

HTML output:

<tr class="portable-infobox-comparison-set">
 <th class="portable-infobox-comparison-set-header">
  <div class="portable-infobox-item item-type-header portable-infobox-item-margins portable-infobox-header-background">
   <h2 class="portable-infobox-header portable-infobox-header-font">First set</h2>
  </div>
 </th>
 <td class="portable-infobox-comparison-item">
  <div class="portable-infobox-item item-type-key-val portable-infobox-item-margins">
   <div class="portable-infobox-item-value">Data1</div>
  </div>
 </td>
 <td class="portable-infobox-comparison-item">
  <div class="portable-infobox-item item-type-key-val portable-infobox-item-margins">
   <div class="portable-infobox-item-value">Data2</div>
  </div>
 </td>
</tr>

Examples