Template:Navbox/doc: Difference between revisions
imported>SpaceNut m (found a way to fix links to Wikipedia without changing templates! good bye red links!) |
m (→Usage) |
||
(25 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{documentation subpage}} | {{documentation subpage}} | ||
This template allows a [[wikipedia:Wikipedia:Navigational templates|navigational template]] to be set up relatively quickly by supplying it one or more lists of links. It comes equipped with default styles that should work for most navigational templates. Changing the default styles is not recommended, but is possible. Using this template is | This template allows a [[wikipedia:Wikipedia:Navigational templates|navigational template]] to be set up relatively quickly by supplying it with navigational content, such as one or more lists of links. It comes equipped with default styles that should work for most navigational templates. Changing the default styles is not recommended, but is possible. Using this template is recommended to standardize navigational templates, and for ease of use. | ||
== Usage == | == Usage == | ||
Line 9: | Line 9: | ||
|name = {{subst:PAGENAME}} | |name = {{subst:PAGENAME}} | ||
|title = | |title = | ||
|above = | |above = | ||
|body = | |||
|group1 = | |group1 = | ||
Line 18: | Line 19: | ||
|list2 = | |list2 = | ||
... | ... | ||
| | |group10 = | ||
| | |list10 = | ||
|below = | |below = | ||
Line 28: | Line 29: | ||
|name = Navbox/doc | |name = Navbox/doc | ||
|state = uncollapsed | |state = uncollapsed | ||
|title = {{{title}}} | |title = {{{title}}} | ||
|above = {{{above}}} | |above = {{{above}}} | ||
|body = {{{body}}} | |||
|group1 = {{{group1}}} | |group1 = {{{group1}}} | ||
|list1 = {{{list1}}} | |list1 = {{{list1}}} | ||
|group2 = {{{group2}}} | |group2 = {{{group2}}} | ||
|list2 = {{{list2}}} | |list2 = {{{list2}}} | ||
|below = {{{below}}}<br />See alternate navbox formats under: [[#Layout overview|''Layout overview'']] and [[#Examples|''Examples'']] | |||
|below = {{{below}}}<br/>See alternate navbox formats under: [[#Layout | |||
}} | }} | ||
The navbox uses lowercase parameter names, as shown in the box (''at right''). The mandatory ''name'' and ''title'' will create a one-line box if other parameters are omitted. | The navbox uses lowercase parameter names, as shown in the box (''at right''). The mandatory ''name'' and ''title'' will create a one-line box if other parameters are omitted. | ||
<br/> | <br /> | ||
Notice "group1" (etc.) is optional, as are sections named "above/below". | Notice "group1" (etc.) is optional, as are sections named "above/below". | ||
Line 47: | Line 45: | ||
The basic and most common parameters are as follows (see below for the full list): | The basic and most common parameters are as follows (see below for the full list): | ||
;<code>name</code>: the name of the template. | |||
;<code>title</code>: text in the title bar, such as: <nowiki>[[Widget stuff]]</nowiki>. | |||
:<code> | ;<code>body</code>: content to appear in the body section, a simplified alternative to group/list pairs (could be a list of overall wikilinks). | ||
;<code>group<sub>n</sub></code>: the left-side text before list-n (if group-n omitted, list-n starts at left of box). | |||
;<code>list<sub>n</sub></code>: text listing wikilinks, often separated by middot templates, such as: [<nowiki />[A]]<code>{<nowiki />{·}}</code> [<nowiki />[B]] | |||
Further details are explained below under section ''[[#Parameter descriptions|Parameter descriptions]]''. See some alternate navbox formats under: [[#Layout overview|''Layout overview'']] and [[#Examples|''Examples'']]. | |||
Further details | |||
==Parameter descriptions== | ==Parameter descriptions== | ||
The following is a complete list of parameters for using {{tl|Navbox}}. In most cases, the only required parameters are <code>name</code>, <code>title</code>, and <code> | The following is a complete list of parameters for using {{tl|Navbox}}. In most cases, the only required parameters are <code>name</code>, <code>title</code>, and either <code>body</code> or <code>group1</code>. | ||
===Setup parameters=== | ===Setup parameters=== | ||
; ''name'' | |||
: The name of the template, which is needed for the "v • d • e" ("view • discuss • edit") links to work properly on all pages where the template is used. You can enter <code><nowiki>{{subst:PAGENAME}}</nowiki></code> for this value as a shortcut. | |||
; ''state'' <span style="font-weight:normal;">[<code>collapsed</code>]</span> | |||
: Defaults to <code>uncollapsed</code>. A navbox with <code>collapsed</code> will start out collapsed. Otherwise, the navbox will be expanded. Often times, editors will want a default initial state for a navbox, which may be overridden in an article. Here is the trick to do this: In your intermediate template, create a parameter also named "state" as a pass-through like this: <tt><nowiki>| state = {{{state<includeonly>|your_desired_initial_state</includeonly>}}}</nowiki></tt>. | |||
===Content=== | |||
; ''title'' | |||
: Text that appears centered at the top of the navbox. It is usually the template's topic, i.e. a succinct description of the body contents. This should be a single line, but if a second line is needed, use <code><nowiki>{{-}}</nowiki></code> to ensure proper centering. | |||
; ''body'' | |||
: If specified, text appears in the body of the navbox. Usually a list of links. A simplified alternative to ''group1'', ''list1'', etc. pairs. | |||
; ''group<sub>n</sub>'' | |||
: (i.e. ''group1'', ''group2'', etc.) If specified, text appears on the left side of the body of the navbox. | |||
; ''list<sub>n</sub>'' | |||
: (i.e. ''list1'', ''list2'', etc.) If specified, text appears to the right of the corresponding ''group<sub>n</sub>'' parameter. Usually a list of links. | |||
; ''above'' | |||
: Text displayed below the title and above the body. | |||
; ''below'' | |||
: Text displayed below the body (groups, lists and image). | |||
=== | |||
: | |||
: | |||
===Style parameters=== | ===Style parameters=== | ||
Styles are generally not recommended as to maintain consistency among templates and pages in Wikipedia. However, the option to modify styles is given. | Styles are generally not recommended as to maintain consistency among templates and pages in Wikipedia. However, the option to modify styles is given. | ||
; ''style'' | |||
: Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the outer container. | |||
; ''basestyle'' | |||
: CSS styles to apply to the ''title'', ''above'', ''below'', and ''group'' cells all at once. The styles are not applied to ''list'' cells. This is convenient for easily changing the basic color of the navbox without having to repeat the style specifications for the different parts of the navbox. | |||
; ''titlestyle'' | |||
: Styles to apply to ''title'', such as the titlebar's background color. | |||
; ''bodystyle'' | |||
: Styles to apply to ''body'', or to the container around ''group'' and ''list'' content. | |||
; ''groupstyle'' | |||
: CSS styles to apply to the ''groupN'' cells. | |||
; ''group<sub>n</sub>style'' | |||
: CSS styles to apply to a specific group, in addition to any styles specified by the ''groupstyle'' parameter. | |||
: | ; ''liststyle'' | ||
: CSS styles to apply to all lists. Overruled by the ''oddstyle'' and ''evenstyle'' parameters (if specified) below. | |||
: | ; ''list<sub>n</sub>style'' | ||
: CSS styles to apply to a specific group, in addition to any styles specified by the ''liststyle'' parameter. | |||
; ''listpadding'' | |||
: A number and unit specifying the padding around each ''list''. Default is padding of 0.25em on the left and right, and 0em on the top and bottom. | |||
; ''oddstyle'', ''evenstyle'' | |||
:Applies to odd/even list numbers. Overrules styles defined by ''liststyle''. The default behavior is to add striped colors (white and gray) to odd/even lists, respectively, in order to improve readability. | |||
; ''evenodd'' <span style="font-weight:normal;"><code>[swap, even, odd, off]</code></span> | |||
: If set to <code>swap</code>, then the automatic striping of even and odd rows is reversed. Normally, even rows get a light gray background for striping; when this parameter is used, the odd rows receive the gray striping instead of the even rows. Setting to <code>even</code> or <code>odd</code> sets all rows to have that striping color. Setting to <code>off</code> disables automatic row striping. | |||
; ''abovestyle'', ''belowstyle'' | |||
: CSS styles to apply to the content specified via the ''above'' or ''below'' parameters. | |||
===== Default styles ===== | ===== Default styles ===== | ||
The style settings listed here are those that editors using the navbox change most often. The other more complex style settings were left out of this list to keep it simple. Most styles are set in [[MediaWiki:Common.css]]. | The style settings listed here are those that editors using the navbox change most often. The other more complex style settings were left out of this list to keep it simple. Most styles are set in [[MediaWiki:Common.css]]. | ||
:<code> | :<code>style = background:#fdfdfd; text-align: center;</code> | ||
:<code>titlestyle = background:#ccccff; padding-left: | :<code>titlestyle = background:#ccccff; padding-left:6em; padding-right:6em;</code> | ||
:<code>abovestyle = background:#ddddff; padding-left:1em; padding-right:1em | :<code>abovestyle = background:#ddddff; padding-left:1em; padding-right:1em;</code> | ||
:<code>belowstyle = background:#ddddff; padding-left:1em; padding-right:1em | :<code>belowstyle = background:#ddddff; padding-left:1em; padding-right:1em;</code> | ||
:<code>groupstyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:right;</code> | :<code>groupstyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:right;</code> | ||
:<code>liststyle = | :<code>liststyle = text-align:left;</code> | ||
:<code>evenstyle = background:#f7f7f7;</code> | :<code>evenstyle = background:#f7f7f7;</code> | ||
Since ''liststyle'' and ''oddstyle'' are transparent odd lists have the color of the '' | Since ''liststyle'' and ''oddstyle'' are transparent odd lists have the color of the main ''style'', which defaults to #fdfdfd (white with a hint of gray). A list has <code>text-align:left;</code> if it has a group, if not it has <code>text-align:center;</code>. Since only ''bodystyle'' has a vertical-align all the others inherit its <code>vertical-align:middle;</code>. | ||
== Layout | == Layout overview == | ||
Layout generated by {{tl|Navbox}} with ''group'' and ''list'' pairs, and without ''above'' and ''below'' parameters (gray list background color added for illustration only): | |||
{{Navbox | {{Navbox | ||
|name = Navbox/doc | |name = Navbox/doc | ||
Line 219: | Line 128: | ||
|group2 = {{{group2}}} | |group2 = {{{group2}}} | ||
|list2 = {{{list2}}} | |list2 = {{{list2}}} | ||
}} | }} | ||
Layout generated by {{tl|Navbox}} with ''body'', ''above'', and ''below'' parameters (gray list background color added for illustration only): | |||
{{Navbox | {{Navbox | ||
|name = Navbox/doc | |name = Navbox/doc | ||
|state = uncollapsed | |state = uncollapsed | ||
|title = {{{title}}} | |title = {{{title}}} | ||
|above = {{{above}}} | |above = {{{above}}} | ||
| | |bodystyle = background:silver; | ||
|body = {{{body}}} | |||
| | |||
|below = {{{below}}} | |below = {{{below}}} | ||
}} | }} | ||
== Examples == | |||
<pre> | |||
{{Navbox | {{Navbox | ||
|name = Navbox/doc | |name = Navbox/doc | ||
|title = [[Archetypes]] | |||
|body = [[Blaster]]{{dot}} [[Brute]]{{dot}} [[Controller]]{{dot}} [[Corruptor]]{{dot}} [[Defender]]{{dot}} [[Dominator]]{{dot}} [[Mastermind]]{{dot}} [[Scrapper]]{{dot}} [[Sentinel]]{{dot}} [[Stalker]]{{dot}} [[Tanker]]{{dot}} [[Arachnos Soldier]]{{dot}} [[Arachnos Widow]]{{dot}} [[Peacebringer]]{{dot}} [[Warshade]] | |||
|title = | |||
| | |||
[[ | |||
}} | }} | ||
</pre> | </pre> | ||
{{Navbox | {{Navbox | ||
|name = Navbox/doc | |name = Navbox/doc | ||
| | |title = [[Archetypes]] | ||
| | |body = [[Blaster]]{{dot}} [[Brute]]{{dot}} [[Controller]]{{dot}} [[Corruptor]]{{dot}} [[Defender]]{{dot}} [[Dominator]]{{dot}} [[Mastermind]]{{dot}} [[Scrapper]]{{dot}} [[Sentinel]]{{dot}} [[Stalker]]{{dot}} [[Tanker]]{{dot}} [[Arachnos Soldier]]{{dot}} [[Arachnos Widow]]{{dot}} [[Peacebringer]]{{dot}} [[Warshade]] | ||
}} | }} | ||
<pre> | |||
{{navbox| | |||
| name = Navbox/doc | |||
| title = [[Issues|Issue Releases]] | |||
{{ | |||
|name = Navbox/doc | |||
|title = [[ | |||
| group1 = [[Cryptic Studios]] | |||
| list1 = [[Issue 1]]{{dot}} [[Issue 2]]{{dot}} [[Issue 3]]{{dot}} [[Issue 4]]{{dot}} [[Issue 5]]{{dot}} [[Issue 6]]{{dot}} [[Issue 7]]{{dot}} [[Issue 8]]{{dot}} [[Issue 9]]{{dot}} [[Issue 10]] | |||
| group2 = [[Paragon Studios]] | |||
| list2 = [[Issue 11]]{{dot}} [[Issue 12]]{{dot}} [[Issue 13]]{{dot}} [[Issue 14]]{{dot}} [[Issue 15]]{{dot}} [[Issue 16]]{{dot}} [[Issue 17]]{{dot}} [[Issue 18]]{{dot}} [[Issue 19]]{{dot}} [[Strike Pack|Issue 19.5]]{{dot}} [[Issue 20]]{{dot}} [[Incarnates Ascend|Issue 20.5]]{{dot}} [[Issue 21]]{{dot}} [[Media Blitz|Issue 21.5]]{{dot}} [[Issue 22]]{{dot}} [[Issue 23]]{{dot}} [[Issue 24]]{{dot}} [[Issue 25 (Paragon Studios)]] | |||
| group3 = [[Homecoming Team]] | |||
| list3 = [[Issue 25]]{{dot}} [[Issue 26]]{{dot}} [[Issue 27]] | |||
}}</pre> | |||
{{navbox| | |||
| name = Navbox/doc | |||
| title = [[Issues|Issue Releases]] | |||
| group1 = [[Cryptic Studios]] | |||
| list1 = [[Issue 1]]{{dot}} [[Issue 2]]{{dot}} [[Issue 3]]{{dot}} [[Issue 4]]{{dot}} [[Issue 5]]{{dot}} [[Issue 6]]{{dot}} [[Issue 7]]{{dot}} [[Issue 8]]{{dot}} [[Issue 9]]{{dot}} [[Issue 10]] | |||
| group2 = [[Paragon Studios]] | |||
| list2 = [[Issue 11]]{{dot}} [[Issue 12]]{{dot}} [[Issue 13]]{{dot}} [[Issue 14]]{{dot}} [[Issue 15]]{{dot}} [[Issue 16]]{{dot}} [[Issue 17]]{{dot}} [[Issue 18]]{{dot}} [[Issue 19]]{{dot}} [[Strike Pack|Issue 19.5]]{{dot}} [[Issue 20]]{{dot}} [[Incarnates Ascend|Issue 20.5]]{{dot}} [[Issue 21]]{{dot}} [[Media Blitz|Issue 21.5]]{{dot}} [[Issue 22]]{{dot}} [[Issue 23]]{{dot}} [[Issue 24]]{{dot}} [[Issue 25 (Paragon Studios)]] | |||
| group3 = [[Homecoming Team]] | |||
| list3 = [[Issue 25]]{{dot}} [[Issue 26]]{{dot}} [[Issue 27]] | |||
}} | }} | ||
== Technical details == | == Technical details == | ||
*This template uses CSS classes for most of its looks, thus it is fully skinnable. | *This template uses CSS classes for most of its looks, thus it is fully skinnable. | ||
*For more technical details see the [[{{TALKPAGENAME}}|talk page]], the CSS classes in [[MediaWiki:common.css]], and [[mw:Manual:Collapsible elements|collapsible elements]] in MediaWiki. | |||
*For more technical details see the [[{{TALKPAGENAME}}|talk page]], the CSS classes in [[MediaWiki:common.css]] and | |||
:: | |||
<includeonly> | <includeonly> | ||
<!--Categories--> | <!--Categories--> | ||
[[Category: | [[Category:Navigation Templates| ]] | ||
</includeonly> | </includeonly> |
Latest revision as of 10:37, 2 November 2022
This template allows a navigational template to be set up relatively quickly by supplying it with navigational content, such as one or more lists of links. It comes equipped with default styles that should work for most navigational templates. Changing the default styles is not recommended, but is possible. Using this template is recommended to standardize navigational templates, and for ease of use.
Usage
Please remove the parameters that are left blank.
{{Navbox |name = {{subst:PAGENAME}} |title = |above = |body = |group1 = |list1 = |group2 = |list2 = ... |group10 = |list10 = |below = }}
Parameter list
The navbox uses lowercase parameter names, as shown in the box (at right). The mandatory name and title will create a one-line box if other parameters are omitted.
Notice "group1" (etc.) is optional, as are sections named "above/below".
The basic and most common parameters are as follows (see below for the full list):
name
- the name of the template.
title
- text in the title bar, such as: [[Widget stuff]].
body
- content to appear in the body section, a simplified alternative to group/list pairs (could be a list of overall wikilinks).
groupn
- the left-side text before list-n (if group-n omitted, list-n starts at left of box).
listn
- text listing wikilinks, often separated by middot templates, such as: [[A]]
{{·}}
[[B]]
Further details are explained below under section Parameter descriptions. See some alternate navbox formats under: Layout overview and Examples.
Parameter descriptions
The following is a complete list of parameters for using {{Navbox}}. In most cases, the only required parameters are name
, title
, and either body
or group1
.
Setup parameters
- name
- The name of the template, which is needed for the "v • d • e" ("view • discuss • edit") links to work properly on all pages where the template is used. You can enter
{{subst:PAGENAME}}
for this value as a shortcut. - state [
collapsed
] - Defaults to
uncollapsed
. A navbox withcollapsed
will start out collapsed. Otherwise, the navbox will be expanded. Often times, editors will want a default initial state for a navbox, which may be overridden in an article. Here is the trick to do this: In your intermediate template, create a parameter also named "state" as a pass-through like this: | state = {{{state<includeonly>|your_desired_initial_state</includeonly>}}}.
Content
- title
- Text that appears centered at the top of the navbox. It is usually the template's topic, i.e. a succinct description of the body contents. This should be a single line, but if a second line is needed, use
{{-}}
to ensure proper centering. - body
- If specified, text appears in the body of the navbox. Usually a list of links. A simplified alternative to group1, list1, etc. pairs.
- groupn
- (i.e. group1, group2, etc.) If specified, text appears on the left side of the body of the navbox.
- listn
- (i.e. list1, list2, etc.) If specified, text appears to the right of the corresponding groupn parameter. Usually a list of links.
- above
- Text displayed below the title and above the body.
- below
- Text displayed below the body (groups, lists and image).
Style parameters
Styles are generally not recommended as to maintain consistency among templates and pages in Wikipedia. However, the option to modify styles is given.
- style
- Specifies CSS styles to apply to the outer container.
- basestyle
- CSS styles to apply to the title, above, below, and group cells all at once. The styles are not applied to list cells. This is convenient for easily changing the basic color of the navbox without having to repeat the style specifications for the different parts of the navbox.
- titlestyle
- Styles to apply to title, such as the titlebar's background color.
- bodystyle
- Styles to apply to body, or to the container around group and list content.
- groupstyle
- CSS styles to apply to the groupN cells.
- groupnstyle
- CSS styles to apply to a specific group, in addition to any styles specified by the groupstyle parameter.
- liststyle
- CSS styles to apply to all lists. Overruled by the oddstyle and evenstyle parameters (if specified) below.
- listnstyle
- CSS styles to apply to a specific group, in addition to any styles specified by the liststyle parameter.
- listpadding
- A number and unit specifying the padding around each list. Default is padding of 0.25em on the left and right, and 0em on the top and bottom.
- oddstyle, evenstyle
- Applies to odd/even list numbers. Overrules styles defined by liststyle. The default behavior is to add striped colors (white and gray) to odd/even lists, respectively, in order to improve readability.
- evenodd
[swap, even, odd, off]
- If set to
swap
, then the automatic striping of even and odd rows is reversed. Normally, even rows get a light gray background for striping; when this parameter is used, the odd rows receive the gray striping instead of the even rows. Setting toeven
orodd
sets all rows to have that striping color. Setting tooff
disables automatic row striping. - abovestyle, belowstyle
- CSS styles to apply to the content specified via the above or below parameters.
Default styles
The style settings listed here are those that editors using the navbox change most often. The other more complex style settings were left out of this list to keep it simple. Most styles are set in MediaWiki:Common.css.
style = background:#fdfdfd; text-align: center;
titlestyle = background:#ccccff; padding-left:6em; padding-right:6em;
abovestyle = background:#ddddff; padding-left:1em; padding-right:1em;
belowstyle = background:#ddddff; padding-left:1em; padding-right:1em;
groupstyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:right;
liststyle = text-align:left;
evenstyle = background:#f7f7f7;
Since liststyle and oddstyle are transparent odd lists have the color of the main style, which defaults to #fdfdfd (white with a hint of gray). A list has text-align:left;
if it has a group, if not it has text-align:center;
. Since only bodystyle has a vertical-align all the others inherit its vertical-align:middle;
.
Layout overview
Layout generated by {{Navbox}} with group and list pairs, and without above and below parameters (gray list background color added for illustration only):
Layout generated by {{Navbox}} with body, above, and below parameters (gray list background color added for illustration only):
Examples
{{Navbox |name = Navbox/doc |title = [[Archetypes]] |body = [[Blaster]]{{dot}} [[Brute]]{{dot}} [[Controller]]{{dot}} [[Corruptor]]{{dot}} [[Defender]]{{dot}} [[Dominator]]{{dot}} [[Mastermind]]{{dot}} [[Scrapper]]{{dot}} [[Sentinel]]{{dot}} [[Stalker]]{{dot}} [[Tanker]]{{dot}} [[Arachnos Soldier]]{{dot}} [[Arachnos Widow]]{{dot}} [[Peacebringer]]{{dot}} [[Warshade]] }}
{{navbox| | name = Navbox/doc | title = [[Issues|Issue Releases]] | group1 = [[Cryptic Studios]] | list1 = [[Issue 1]]{{dot}} [[Issue 2]]{{dot}} [[Issue 3]]{{dot}} [[Issue 4]]{{dot}} [[Issue 5]]{{dot}} [[Issue 6]]{{dot}} [[Issue 7]]{{dot}} [[Issue 8]]{{dot}} [[Issue 9]]{{dot}} [[Issue 10]] | group2 = [[Paragon Studios]] | list2 = [[Issue 11]]{{dot}} [[Issue 12]]{{dot}} [[Issue 13]]{{dot}} [[Issue 14]]{{dot}} [[Issue 15]]{{dot}} [[Issue 16]]{{dot}} [[Issue 17]]{{dot}} [[Issue 18]]{{dot}} [[Issue 19]]{{dot}} [[Strike Pack|Issue 19.5]]{{dot}} [[Issue 20]]{{dot}} [[Incarnates Ascend|Issue 20.5]]{{dot}} [[Issue 21]]{{dot}} [[Media Blitz|Issue 21.5]]{{dot}} [[Issue 22]]{{dot}} [[Issue 23]]{{dot}} [[Issue 24]]{{dot}} [[Issue 25 (Paragon Studios)]] | group3 = [[Homecoming Team]] | list3 = [[Issue 25]]{{dot}} [[Issue 26]]{{dot}} [[Issue 27]] }}
Technical details
- This template uses CSS classes for most of its looks, thus it is fully skinnable.
- For more technical details see the talk page, the CSS classes in MediaWiki:common.css, and collapsible elements in MediaWiki.