Template:Navbox
Editors can experiment in this template's sandbox (edit | diff) and test cases (edit) pages.
Subpages of this template.
Synopsis
This is a "navbox" or "navigational box". It's used as a footer template to browse related topics without a massive "See also" section.
The good news about this template is that there are many options to choose from. The bad news about this template…is that there are many options to choose from.
|name=
is obligatory and must equal the template name without prefix; |title=
and |bodyclass=hlist
(or |listclass=hlist
)[note 1] should be included in almost every template once. Using |groupX=
and |listX=
will give you a basic list.
Layout
|
Basic tutorial
It's preferable to lay it out vertically in "block format". |name=
, |title=
, and |bodyclass=hlist
are standard, so:
{{Navbox
|name=Hairy
|title=All About Facial Hair
|bodyclass=hlist
}}
If we want an image or two, we should ask for it before the lists (because it's easier to find). |image=
refers to the right:
{{Navbox
|name=Hairy
|title=All About Facial Hair
|bodyclass=hlist
|image=[[File:FacialHair.gif|64px]]
}}
Now use |groupX=
and |listX=
where X is a number beginning with one, up to twenty. For lists, use ASCII bullets and wrap it in a div:
{{Navbox
|name=Hairy
|title=All About Facial Hair
|bodyclass=hlist
|image=[[File:FacialHair.gif|64px]]
|group1=Articles
|list1=<div>
* [[Beard]]
* [[Bearded dragon]]
* [[Moustache]]
</div>
}}
to render:
|
To add False moustache, we may decide it belongs with Moustache. We use two ASCII bullets to add it to our list and automagically put it in parentheses:
{{Navbox
|name=Hairy
|title=All About Facial Hair
|bodyclass=hlist
|image=[[File:FacialHair.gif|64px]]
|group1=Articles
|list1=<div>
* [[Beard]]
* [[Bearded dragon]]
* [[Moustache]]
** [[False moustache]]
</div>
}}
to render:
|
Let's add a second area.
{{Navbox
|name=Hairy
|title=All About Facial Hair
|bodyclass=hlist
|image=[[File:FacialHair.gif|64px]]
|group1=Articles
|list1=<div>
* [[Beard]]
* [[Bearded dragon]]
* [[Moustache]]
** [[False moustache]]
</div>
|group2=Hairy people
|list2=<div>
* [[Abraham Lincoln]]
* [[Blackbeard]]
* [[ZZ Top]]
</div>
}}
to render:
|
And that's it!
Color tutorial
This is specific to Uncyclopedia, because Wikipedia styles navboxes only minimally. As long as navigation templates aren't distracting, colors can be customized to fit the topic: a red style for Communist articles, a black style for Goth articles, and so on. This quick tutorial teaches what problem |bodyclass=navbox-inherit-color
solves.
Our use case for this example: we want a blue navbox. We try:
{{Navbox |name=Navbox/doc |basestyle=background:blue; color:white; |title=[[Test]] |bodyclass=hlist |group1=[[One]] |list1=<div> * item * item * item </div> |group2=[[Two]] |list2=<div> * item * item * item </div> }}
|
Notice how the wikilinks for Test, One and Two are hard to see because wikilinks in the title and groups default to #0645ad
, and we want our basestyle
parameter to stay blue
. We could do it like [[Test|<span style="color:white;">Test</span>]]
, [[One|<span style="color:white;">One</span>]]
and [[Two|<span style="color:white;">Two</span>]]
— but that would be tedious if our navbox has many groups. Instead we'll work smarter, not harder:
{{Navbox
|name=Navbox/doc
|basestyle=background:blue; color:white;
|title=[[Test]]
|bodyclass=hlist navbox-inherit-color
|group1=[[One]]
|list1=<div>
* item
* item
* item
</div>
|group2=[[Two]]
|list2=<div>
* item
* item
* item
</div>
}}
|
The difference was:
|bodyclass=navbox-inherit-color
Notes
- ↑
|listclass=hlist
is usually sufficient.|bodyclass=hlist
also sets|aboveclass=
,|belowclass=
, and|titleclass=
to hlist for fewer surprises: a horizontal list of band members sometimes occurs in musical group templates, and|bodyclass=navbox-inherit-color
avoids the need to specify the class separately for both groups and titles.
See also
- wikipedia:Template:Navbox - full documentation
- wikipedia:Template:Navbox/testcases - has many examples, that can be examined by the curious