12,859 bytes added
, 15:35, 30 June 2016
m{{Documentation subpage}}
{{Lua|Module:Sidebar}}
{{High-risk| 158,000+ }}
<!-----Edit template documentation below this line----->
{{about|the vertical navigation template|the horizontal template|Template:Navbox|the left sidebar of the interface|mw:Manual:Interface/Sidebar{{!}}the article in the Mediawiki Manual}}
This template is a [[wikt:Metatemplate|metatemplate]] for the creation of sidebar templates, i.e. boxes that are [[Vertical direction|vertically]]-aligned [[Wikipedia:Navigation templates|navigation templates]]. Sidebars, like [[Wikipedia:Manual of Style/Infoboxes|infoboxes]], are usually positioned on the right-hand side of a page.
{{tl|Sidebar with collapsible lists}} is a version of {{tl|Sidebar}} that adds collapsibility to its sections, i.e. the means to show or hide sections by clicking links beside their headings.
{{Navbox visibility}}
== Usage ==
{{Generic template demo |name={{PAGENAME}} |pretitle |title |image |above |heading1 |content1 |heading2 |content2 |heading3 |content3 |content4=''…… etc ……'' |heading35 |content35 |below}}
(parameters with infrequent use omitted)
<pre style="overflow:auto;">
{{Sidebar
| name = {{subst:PAGENAME}}
| pretitle =
| title =
| image =
| headingstyle =
| contentstyle =
| above =
| heading1 =
| content1 =
| heading2 =
| content2 =
| heading3 =
| content3 =
<!-- etc, to: -->
| heading35 =
| content35 =
| below =
}}
</pre>
== Parameters ==
No parameters are mandatory, but if the {{small|{{smallcaps|V{{dot}}T{{dot}}E}}}} {{tl|navbar}} links along the bottom of a {{tlf|Sidebar}} are to function correctly (unless their appearance is suppressed; see the ''navbar'' parameter [[#Other parameters|below]]), the parameter ''name'' needs to be set (to [[Wikipedia:Page name|the name of]] the sidebar's page). (This does not apply if the [[Lua (programming language)|Lua module]] that produces {{tlf|Sidebar}}, [[Module:Sidebar]], is being used directly.)
===Principal parameters===
{| class="wikitable" style="line-height:1.4em;"
!style="width:14.0em<!--(cf table below)-->;padding-left:0.25em;text-align:left;"| Parameter
!style="padding-left:0.5em;text-align:left;"| Explanation
|-
| {{para|name}}
|style="padding-left:0.5em;"| The sidebar's name, i.e. the name following "Template:" in the title shown at the top of the sidebar's page. <br />Required if the {{small|{{smallcaps|V{{dot}}T{{dot}}E}}}} {{tl|navbar}} links at the bottom of the sidebar are to function correctly, unless their appearance is suppressed (see the ''navbar'' parameter [[#Other parameters|below]]) or {{tlf|Sidebar}} is not being used as a [[Wrapper function|wrapper]] for [[Module:Sidebar]]. When {{tlf|Sidebar}} is used as a wrapper, setting {{para|name|<nowiki>{{subst:PAGENAME}}</nowiki>}} is recommended.
|-
| {{para|outertitle}}
|style="padding-left:0.5em;"| Use to place a title for the sidebar immediately above the sidebar.
|-
| {{para|topimage}}
|style="padding-left:0.5em;"| Use to place an image at the top of the sidebar, i.e. above {{para|title}} (if used). Full wiki syntax is expected (i.e. <code><nowiki>[[File:...]]</nowiki></code>). <br />To add a caption below the image, use {{para|topcaption}}.
|-
| {{para|pretitle}}
|style="padding-left:0.5em;"| Use to place a line such as "Part of the ''X'' series on" before the title.
|-
| {{para|title}}
|style="padding-left:0.5em;"| Use to place a title for the sidebar at the top of the sidebar. (If {{para|topimage}} is used, it will appear immediately below it).
|-
| {{para|image}}
|style="padding-left:0.5em;"| Use to place an image between the {{para|title}} (if used) and first section. As with {{para|topimage}}, full wiki syntax is expected (i.e. <code><nowiki>[[File:...]]</nowiki></code>). <br />To add a caption below the image, use {{para|caption}}.
|-
| {{para|headingstyle}}
|style="padding-left:0.5em;"| Use to alter the default [[Help:Cascading Style Sheets|CSS]] styling set for section headings. <br />To alter the CSS styling for a specific section's heading, use {{para|heading<sub>n</sub>style}}, where ''n'' is the number of the section.
|-
| {{para|contentstyle}}
|style="padding-left:0.5em;"| Use to alter the default CSS styling set for section content. <br />To alter the CSS styling for a particular section's content, use {{para|content<sub>n</sub>style}}, where ''n'' is the number of the section.
|-
| {{para|heading1}}<br/>{{para|content1}}
|style="padding-left:0.5em;"| First section's heading{{\}}content. ''content1'' is required if ''heading1'' is also to appear.
|-
| {{para|heading2}}<br/>{{para|content2}}
|style="padding-left:0.5em;"| Second section's heading{{\}}content. (''content2'' required if ''heading2'' also to appear; etc.)
|-
| {{para|heading3}}<br/>{{para|content3}}
|style="padding-left:0.5em;"| Third section's heading{{\}}content.
|-
|colspan="2" style="padding-left:0.5em;"| ...... etc ......
|-
| {{para|heading35}}<br/>{{para|content35}}
|style="padding-left:0.5em;"| Currently, the last possible section heading and/or content.
|}
===Other parameters===
<!--Linked from [[Template:Subinfobox bodystyle/doc]]-->
{| class="wikitable plainlist" style="line-height:1.4em;"
!style="width:14.0em<!--(cf table above)-->;padding-left:0.25em;text-align:left;"| Parameter
!style="padding-left:0.5em;text-align:left;"| Explanation
|-
| {{para|above}}
|style="padding-left:0.5em;"| Same as the {{para|above}} offered by {{tl|Navbox}}.
|-
|
*{{nowrap|{{para|class}} or {{para|bodyclass}}}}
*{{para|outertitleclass}}
*{{para|topimageclass}}
*{{para|pretitleclass}}
*{{para|titleclass}}
*{{para|imageclass}}
*{{para|aboveclass}}
*{{para|headingclass}}
*{{para|contentclass}}
*{{para|belowclass}}
|style="padding-left:0.5em;"|
[[Wikipedia:WikiProject Microformats#What are microformats?|Microformat]] classes for the corresponding parameters. <br />({{para|class}} and {{para|bodyclass}} are applied across the whole sidebar.)
|-
| {{para|below}}
|style="padding-left:0.5em;"| Same as the {{para|below}} offered by {{tl|Navbox}}.<br />(Use, for example, to add one or more portal links to the bottom of the template (shown, by default, in bold).)
|-
|
*{{nowrap|{{para|style}} or {{para|bodystyle}}}}
*{{para|outertitlestyle}}
*{{para|topimagestyle}}
*{{para|topcaptionstyle}}
*{{para|pretitlestyle}}
*{{para|titlestyle}}
*{{para|imagestyle}}
*{{para|captionstyle}}
*{{para|abovestyle}}
*{{para|headingstyle}}
*{{para|heading<sub>n</sub>style}}
*{{para|contentstyle}}
*{{para|content<sub>n</sub>style}}
*{{para|belowstyle}}
*{{longitem|{{para|navbarstyle}}<br/>{{nbsp|2}}{{smaller|(or {{para|tnavbarstyle}})}}}}
|style="padding-left:0.5em;"|
Use to alter the default [[Help:Cascading Style Sheets|CSS]] styling for the corresponding parameters. <br />({{para|style}} and {{para|bodystyle}} are applied across the whole sidebar.)
|-
| {{para|cellspacing}}<br/>{{para|cellpadding}}
|style="padding-left:0.5em;"| Use to amend the default cellspacing{{\}}cellpadding set for the infobox-class table with which the sidebar is built.
|-
| {{longitem|{{para|navbar}}{{nowrap|{{nbsp|2}}{{smaller|(or {{para|tnavbar}})}}}}}}
|style="padding-left:0.5em;"| Set to "off", "none", etc. (without quotes) to remove the {{tl|navbar}} links ({{small|{{smallcaps|V{{dot}}T{{dot}}E}}}}) that otherwise appear at the bottom of the sidebar.
|-
| {{longitem|{{para|navbarfontstyle}}<br/>{{nbsp|2}}{{smaller|(or {{para|tnavbarfontstyle}})}}}}
|style="padding-left:0.5em;"| Use to specify the font style used by the navbar at the bottom of the sidebar (see {{tl|navbar}} for options available).
|}
== Handling long links ==
{{tl|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 {{tlx|normalwraplink|''longlinkname''}}, where {{para||''longlinkname''}} is the long link without its square brackets.
Use the {{para|wraplinks|true}} parameter to turn link wrapping off for the whole template.
== Embedding ==
One sidebar template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular sidebar, or to create more well-defined and logical sections.
{{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
}}
<pre style="position:relative;bottom:0.5em; overflow:auto;">
{{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
}}
</pre>
Note in the examples above that the child sidebar is placed in a {{code|content}} field, not a {{code|heading}} field. Notice also that the section subheadings do not appear in bold if this is not explicitly specified. To obtain bold section headings, place the child sidebar in a {{code|heading}} field, using either:
{{Sidebar
| title = Top-level title
| heading1 =
{{Sidebar |child=yes
| title = First subsection
| heading1 = Heading 1.1
| content1 = Content 1.1
}}
| heading2 =
{{Sidebar |child=yes
| title = Second subsection
| heading1 = Heading 2.1
| content1 = Content 2.1
}}
| below = "below" text
}}
<pre style="position:relative;bottom:0.5em; overflow:auto;">
{{Sidebar
| title = Top-level title
| heading1 =
{{Sidebar |child=yes
| title = First subsection
| heading1 = Heading 1.1
| content1 = Content 1.1
}}
| heading2 =
{{Sidebar |child=yes
| title = Second subsection
| heading1 = Heading 2.1
| content1 = Content 2.1
}}
| below = "below" text
}}
</pre>
or:
{{Sidebar
| title = Top-level title
| heading1 = First subsection
{{Sidebar |child=yes
| heading1 = Heading 1.1
| content1 = Content 1.1
}}
| heading2 = Second subsection
{{Sidebar |child=yes
| heading1 = Heading 2.1
| content1 = Content 2.1
}}
| below = "below" text
}}
<pre style="position:relative;bottom:0.5em; overflow:auto;">
{{Sidebar
| title = Top-level title
| heading1 = First subsection
{{Sidebar |child=yes
| heading1 = Heading 1.1
| content1 = Content 1.1
}}
| heading2 = Second subsection
{{Sidebar |child=yes
| heading1 = Heading 2.1
| content1 = Content 2.1
}}
| below = "below" text
}}
</pre>
Note that omitting the {{para|title}} parameter and not including any text preceding the embedded sidebar may result in the creation of gaps by spurious blank rows.
== Full blank syntax ==
{{Generic template demo |name= |outertitle |topimage |pretitle |title |image |caption |above |heading1 |content1 |heading2 |content2 |heading3 |content3 |content4=''…… etc ……'' |heading35 |content35 |below}}
(omitting heading4/content4 to penultimate heading/content parameters)
<pre style="overflow:auto;">
{{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 =
| belowclass =
| belowstyle =
| below =
| navbarstyle = <!-- or: | tnavbarstyle = -->
| navbarfontstyle = <!-- or: | tnavbarfontstyle = -->
| navbar = <!-- or: | tnavbar = --> <!-- "off", "none", etc otherwise (default:) omit -->
}}
</pre>
== Supplementary documentation ==
Supplementary related documentation (concerning {{tl|navbar}} use within a sidebar) is at [[Template:Navbar/doc]].
== See also ==
* [https://en.wikipedia.org/w/index.php?title=Template:Sidebar&oldid=609911857 Last pre-Lua version]
* {{tl|Sidebar with collapsible lists}}
* {{tl|Infobox}}
* [[Wikipedia:UBLIST]], for help using unbulleted lists within content.
<includeonly>
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}} |
[[Category:Sidebar templates| ]]
[[Category:Wikipedia metatemplates]]
[[Category:Navigational boxes| ]]
[[Category:Exclude in print]]
}}
</includeonly>