Cannabis Ruderalis

Content deleted Content added
Izno (talk | contribs)
Izno (talk | contribs)
→‎Parameters: condense
Line 114: Line 114:
* {{para|grandchild templatestyles}}
* {{para|grandchild templatestyles}}
|
|
These three parameters take the pagename of a [[WP:TemplateStyles|TemplateStyles]] page and turn it into a TemplateStyles tag. These tags are loaded in this order: Core templatestyles ([[Module:Sidebar/styles.css]]), templatestyles, child, and then grandchild, which can be used for 'cascading' styles.


; {{para|templatestyles}}
; {{para|templatestyles}}
: This parameter takes a pagename of a TemplateStyles page and turns it into a TemplateStyles tag that is placed between the root TemplateStyles page ([[Module:Sidebar/styles.css]]) and between the child TemplateStyles page when used (and the main sidebar when not used). This parameter is intended for a template or module calling {{tl|sidebar}} directly.
: This parameter is intended for a template or module calling {{tl|sidebar}} directly.
; {{para|child templatestyles}}
; {{para|child templatestyles}}
: This parameter is intended for a template or module which calls a sidebar with {{para|templatestyles}}.
: This parameter takes a pagename of a TemplateStyles page and turns it into a TemplateStyles tag that is placed between the 'main' TemplateStyles page and between the grandchild TemplateStyles page when used (and the main sidebar when not used). This parameter is intended for a template or module which calls a template or module which itself calls {{tl|sidebar}} directly, and can be named appropriately.
; {{para|grandchild templatestyles}}
; {{para|grandchild templatestyles}}
: This parameter takes a pagename of a TemplateStyles page and turns it into a TemplateStyles tag that is placed between the child TemplateStyles page and the main sidebar. Intended for a template or module which is another layer below.
: This parameter is intended for a template or module which calls a sidebar with {{para|child templatestyles}}.


For an example of a sidebar which does not need to support children templates of its own (whether because it has no children or because it wants no children):
For an example of a sidebar which does not need to support children templates of its own (whether because it has no children or because it wants no children):

Revision as of 21:15, 25 January 2021

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.

Templates using the classes class=navbox ({{navbox}}) or class=nomobile ({{sidebar}}) are not displayed on the mobile web site of English Wikipedia. Mobile page views account for approximately 66% of all page views (90-day average as of January 2024).

Usage

Parameters with infrequent use omitted:

{{Sidebar
| name = {{subst:PAGENAME}}
| pretitle = 
| title = 
| image = 
| templatestyles =

| above = 

| heading1 = 
| content1 = 

| heading2 = 
| content2 = 

| heading3 = 
| content3 = 

<!-- infinite heading/content parameters elided -->

| below = 

}}

Parameters

No parameters are mandatory. If {{navbar}} links 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

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 ·· E {{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=.
|headingn=
|contentn=
The nth heading / content. contentn is required if headingn is also to appear.
|templatestyles= See #TemplateStyles.

Other parameters

Parameter Explanation
|above= Same as the |above= offered by {{Navbox}}.
  • |class= or |bodyclass=
  • |outertitleclass=
  • |topimageclass=
  • |pretitleclass=
  • |titleclass=
  • |imageclass=
  • |aboveclass=
  • |headingclass=
  • |contentclass=
  • |headingnclass=
  • |contentnclass=
  • |belowclass=

Microformat classes for the corresponding parameters.
(|class= and |bodyclass= are applied across the whole sidebar.)

|class= should be used to specify a class for the purpose of Wikipedia:TemplateStyles for the specific sidebar being created. An example for a template named "Template:Example Sidebar" might be |class=example-sidebar. See the TemplateStyles page for other "rules" associated with TemplateStyles.

|headingnclass= and |contentnclass= can be used to target a specific heading or content group. This should be needed only rarely.

|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).)
|navbar= Set to "off", "none", etc. (without quotes) to remove the {{navbar}} links (·· E) that otherwise appear at the bottom of the sidebar.
  • |templatestyles=
  • |child templatestyles=
  • |grandchild templatestyles=

These three parameters take the pagename of a TemplateStyles page and turn it into a TemplateStyles tag. These tags are loaded in this order: Core templatestyles (Module:Sidebar/styles.css), templatestyles, child, and then grandchild, which can be used for 'cascading' styles.

|templatestyles=
This parameter is intended for a template or module calling {{sidebar}} directly.
|child templatestyles=
This parameter is intended for a template or module which calls a sidebar with |templatestyles=.
|grandchild templatestyles=
This parameter is intended for a template or module which calls a sidebar with |child templatestyles=.

For an example of a sidebar which does not need to support children templates of its own (whether because it has no children or because it wants no children):

{{Sidebar
| title                = Child Example
| class                = sidebar-example
| templatestyles = Template:Sidebar/example/styles.css
}}

For an example of a sidebar which does have its own children and an example of one of the children:

{{Sidebar
| title                     = {{{title|Title Child Example}}}
| class                     = sidebar-example {{{class|}}}
| templatestyles      = Template:Sidebar/example/styles.css
| child templatestyles = {{{child templatestyles|}}}
}}
{{Sidebar/child example
| title                = Title Grandchild Example
| class                = sidebar-child-example
| child templatestyles = Template:Sidebar/child example/styles.css
}}

Handling long links

{{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

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.

{{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 content field, not a heading 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 heading field, using

{{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

{{Sidebar
| name = {{subst:PAGENAME}}
| class =            <!-- or: | bodyclass = -->
| wraplinks =        <!-- "true" otherwise (default:) omit -->
| templatestyles = 
| child templatestyles = 
| grandchild templatestyles = 

| outertitleclass = 
| outertitle = 

| topimageclass = 
| topimage = 
| topcaption = 

| pretitleclass = 
| pretitle = 

| titleclass = 
| title = 

| imageclass = 
| image = 
| caption = 

| headingclass = 
| contentclass = 

| aboveclass = 
| above = 

| heading1 = 
| heading1class = 
| content1 = 
| content1class = 

| heading2 = 
| heading2class = 
| content2 = 
| content2class = 

| heading3 = 
| heading3class = 
| content3 = 
| content3class = 

<!-- (omitting infinite heading/content parameters -->

| belowclass = 
| below = 
| navbar = 

}}

Deprecated parameters

The following parameters are deprecated in favor of Wikipedia:TemplateStyles and templates/modules using them are categorized into Category:Sidebars with styles needing conversion.

Parameter Explanation
|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.
  • |style= or |bodystyle=
  • |outertitlestyle=
  • |topimagestyle=
  • |topcaptionstyle=
  • |pretitlestyle=
  • |titlestyle=
  • |imagestyle=
  • |captionstyle=
  • |abovestyle=
  • |headingstyle=
  • |headingnstyle=
  • |contentstyle=
  • |contentnstyle=
  • |belowstyle=
  • |navbarstyle=

Use to alter the default CSS styling for the corresponding parameters.
(|style= and |bodystyle= are applied across the whole sidebar.)

|navbarfontstyle= Use to specify the font style used by the navbar at the bottom of the sidebar (see {{navbar}} for options available).

Tracking category

See also


Leave a Reply