Template:Sidebar
Template:High-riskTemplate:Template display
This template uses Lua: |
This template is a metatemplate for the creation of sidebar templates, i.e. boxes that are vertically-aligned navigation templates. Sidebars, like infoboxes, are usually positioned on the right-hand side of a page.
{{Sidebar with collapsible lists}} is a version of {{Sidebar}} that adds collapsibility to its sections, i.e. the means to show or hide sections by clicking links beside their headings.
Usage[edit source]
Template:Generic template demo (parameters with infrequent use omitted)
{{Sidebar | style = | name = {{subst:PAGENAME}} | pretitle = | title = | image = | headingstyle = | contentstyle = | above = | heading1 = | content1 = | heading2 = | content2 = | heading3 = | content3 = <!-- etc, to: --> | heading35 = | content35 = | below = }}
Parameters[edit source]
No parameters are mandatory, but if the Template:Small {{navbar}} links along the bottom of a {{Sidebar}} are to function correctly (unless their appearance is suppressed; see the navbar parameter below), the parameter name needs to be set (to the name of the sidebar's page). (This does not apply if the Lua module that produces {{Sidebar}}, Module:Sidebar, is being used directly.)
Principal parameters[edit source]
Parameter | Explanation |
---|---|
|name=
|
The sidebar's name, i.e. the name following "Template:" in the title shown at the top of the sidebar's page. Required if the Template:Small {{navbar}} links at the bottom of the sidebar are to function correctly, unless their appearance is suppressed (see the navbar parameter below) or {{Sidebar}} is not being used as a wrapper for Module:Sidebar. When {{Sidebar}} is used as a wrapper, setting |name={{subst:PAGENAME}} is recommended.
|
|outertitle=
|
Use to place a title for the sidebar immediately above the sidebar. |
|topimage=
|
Use to place an image at the top of the sidebar, i.e. above |title= (if used). Full wiki syntax is expected (i.e. [[File:...]] ). To add a caption below the image, use |topcaption= .
|
|pretitle=
|
Use to place a line such as "Part of the X series on" before the title. |
|title=
|
Use to place a title for the sidebar at the top of the sidebar. (If |topimage= is used, it will appear immediately below it).
|
|image=
|
Use to place an image between the |title= (if used) and first section. As with |topimage= , full wiki syntax is expected (i.e. [[File:...]] ). To add a caption below the image, use |caption= .
|
|headingstyle=
|
Use to alter the default CSS styling set for section headings. To alter the CSS styling for a specific section's heading, use |headingnstyle= , where n is the number of the section.
|
|contentstyle=
|
Use to alter the default CSS styling set for section content. To alter the CSS styling for a particular section's content, use |contentnstyle= , where n is the number of the section.
|
|heading1= |content1=
|
First section's headingTemplate:\content. content1 is required if heading1 is also to appear. |
|heading2= |content2=
|
Second section's headingTemplate:\content. (content2 required if heading2 also to appear; etc.) |
|heading3= |content3=
|
Third section's headingTemplate:\content. |
...... etc ...... | |
|heading35= |content35=
|
Currently, the last possible section heading and/or content. |
Other parameters[edit source]
Parameter | Explanation |
---|---|
|above=
|
Same as the |above= offered by {{Navbox}}.
|
|
Microformat classes for the corresponding parameters. |
|below=
|
Same as the |below= offered by {{Navbox}}.(Use, for example, to add one or more portal links to the bottom of the template (shown, by default, in bold).) |
|
Use to alter the default CSS styling for the corresponding parameters. |
|cellspacing= |cellpadding=
|
Use to amend the default cellspacingTemplate:\cellpadding set for the infobox-class table with which the sidebar is built. |
Template:Longitem | Set to "off", "none", etc. (without quotes) to remove the {{navbar}} links (Template:Small) that otherwise appear at the bottom of the sidebar. |
Template:Longitem | Use to specify the font style used by the navbar at the bottom of the sidebar (see {{navbar}} for options available). |
Handling long links[edit source]
{{Normalwraplink}} may be used to handle links that should wrap within the sidebar or otherwise need to be made to wrap, in order to prevent the sidebar from becoming too wide. Use {{normalwraplink|longlinkname}}
, where |longlinkname
is the long link without its square brackets.
Use the |wraplinks=true
parameter to turn link wrapping off for the whole template.
Embedding[edit source]
One sidebar template can be embedded into another using the |child=
parameter. This feature can be used to create a modular sidebar, or to create more well-defined and logical sections.
Top-level title | ||
---|---|---|
First subsection
|
||
Second subsection
|
||
"below" text |
{{Sidebar | title = Top-level title | content1 = {{Sidebar |child=yes | title = First subsection | heading1 = Heading 1.1 | content1 = Content 1.1 }} | content2 = {{Sidebar |child=yes | title = Second subsection | heading1 = Heading 2.1 | content1 = Content 2.1 }} | below = "below" text }}
Note in the examples above that the child sidebar is placed in a Template:Code field, not a Template:Code field. Notice also that the section subheadings do not appear in bold if this is not explicitly specified. To obtain bold section headings, move the titles to the Template:Code field, using
Top-level title | ||
---|---|---|
First subsection | ||
|
||
Second subsection | ||
|
||
"below" text |
{{Sidebar | title = Top-level title | heading1 = First subsection | content1 = {{Sidebar |child=yes | heading1 = Heading 1.1 | content1 = Content 1.1 }} | heading2 = Second subsection | content2 = {{Sidebar |child=yes | heading1 = Heading 2.1 | content1 = Content 2.1 }} | below = "below" text }}
Full blank syntax[edit source]
Template:Generic template demo
{{Sidebar
| name = {{subst:PAGENAME}}
| class = <!-- or: | bodyclass = -->
| style = <!-- or: | bodystyle = -->
| width =
| cellspacing =
| cellpadding =
| wraplinks = <!-- "true" otherwise (default:) omit -->
| outertitleclass =
| outertitlestyle =
| outertitle =
| topimageclass =
| topimagestyle =
| topimage =
| topcaptionstyle =
| topcaption =
| pretitleclass =
| pretitlestyle =
| pretitle =
| titleclass =
| title =
| imageclass =
| imagestyle =
| image =
| captionstyle =
| caption =
| headingclass =
| headingstyle =
| contentclass =
| contentstyle =
| aboveclass =
| abovestyle =
| above =
| heading1style =
| heading1 =
| content1style =
| content1 =
| heading2style =
| heading2 =
| content2style =
| content2 =
| heading3style =
| heading3 =
| content3style =
| content3 =
<!-- etc, to: -->
| heading35style =
| heading35 =
| content35style =
| content35 =
<!-- (omitting heading4/content4 to penultimate heading/content parameters) -->
| belowclass =
| belowstyle =
| below =
| navbarstyle = <!-- or: | tnavbarstyle = -->
| navbarfontstyle = <!-- or: | tnavbarfontstyle = -->
| navbar = <!-- or: | tnavbar = --> <!-- "off", "none", etc otherwise (default:) omit -->
}}
Supplementary documentation[edit source]
Supplementary related documentation (concerning {{navbar}} use within a sidebar) is at Template:Navbar/doc.
Tracking category[edit source]
See also[edit source]
- Last pre-Lua version
- {{Sidebar with collapsible lists}}
- {{Infobox}}
- Wikipedia:UBLIST, for help using unbulleted lists within content.
The above documentation is transcluded from Template:Sidebar/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |