Template:Spoiler
This template hides story content in a spoiler box. The box shows a short warning and a Show link; the content stays hidden until the reader opens it. It is the wiki's way of marking story spoilers (see How to contribute#Spoilers).
This is what a spoiler box looks like. The text inside stays hidden until you select Show.
Usage
Short content
{{Spoiler|mission=5|1=Hale gives the order to fall back to the hall.}}
Always write the content as 1=. Without it, an equals sign anywhere in the text (for example inside a link or a style) breaks the template.
Long sections
For a section with paragraphs, lists or tables, use the pair {{Spoiler start}} and {{Spoiler end}} instead. It takes the same parameters, and the content between the two is ordinary wikitext:
== Story ==
{{Spoiler start|mission=5}}
First paragraph.
* A list item.
{{Spoiler end}}
Keep section headings outside the box. A heading inside a closed box still appears in the table of contents, but following it does not open the box.
Inside an infobox
Add compact=yes for a one-line warning, which fits a narrow table cell:
| objectives = {{Spoiler|mission=5|compact=yes|1=<ol><li>Hold the first assault.</li></ol>}}
Use HTML lists (<ol><li>) inside a template parameter. Wikitext lists need a new line, and table syntax (|) cannot be used there at all.
Parameters
| Parameter | Meaning |
|---|---|
1 |
The hidden content. Write it as 1=....
|
mission |
Optional. A mission number; the warning then reads "Story spoilers: Mission 5". |
about |
Optional, used when mission is not given. Free text for the warning, for example about=Missions 1-10.
|
compact |
Optional. yes leaves out the second line of the warning.
|
How it works
- It uses only MediaWiki core: the
mw-collapsible mw-collapsedclasses, which the software turns into a closed box with a Show / Hide link. No extension is needed. - The colours use the skin's own colour variables, with fixed fallbacks, so the box stays readable in light and dark display modes.
- Readers who browse without JavaScript see the content open. The warning line is still shown above it.
- In the visual editor a spoiler box appears as one block. To edit the text inside it, use Edit source.
- This template and its two partners are protected, because every story page depends on them.
When to use it
- Wrap anything that tells what happens in the Story campaign: mission plots, objectives that give away events, what happens to characters, and endings.
- A mission's name, number, chapter and map are not spoilers.
- Pages about mechanics, units and buildings should not need it.
Hides story spoilers in a closed box with a warning and a Show link. For long sections use Spoiler start and Spoiler end.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Content | 1 | The hidden text. Write it as 1=... | Content | required |
| Mission number | mission | Shown in the warning, e.g. 5 gives 'Story spoilers: Mission 5'. | Number | optional |
| About | about | Free text for the warning when no mission number is given. | String | optional |
| Compact | compact | yes = a one-line warning, for table cells.
| String | optional |