Пређи на садржај

Шаблон:Sidebar/док

Извор: Викизворник


Шаблон:About

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.

Навигацијске кутије и други шаблони који користе navbox (navbox) или nomobile (sidebar) атрибуте се не приказују на мобилној верзији веб-сајта Википедија, што се односи на просечно 30 % читалаца.

Usage

[уреди]

Шаблон:Generic template demo

{{Sidebar
| name = {{subst:PAGENAME}}
| class =            
| 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 = 

}}

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 Шаблон:Tlf, Module:Sidebar, is being used directly.)

Parameter Explanation
Шаблон:Para Same as the Шаблон:Para offered by {{Navbox}}.
Шаблон:Para 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 Шаблон:Small {{navbar}} links at the bottom of the sidebar are to function correctly, unless their appearance is suppressed (see the navbar parameter below) or Шаблон:Tlf is not being used as a wrapper for Module:Sidebar. When Шаблон:Tlf is used as a wrapper, setting Шаблон:Para is recommended.
Шаблон:Para Use to place a title for the sidebar immediately above the sidebar.
Шаблон:Para Use to place an image at the top of the sidebar, i.e. above Шаблон:Para (if used). Full wiki syntax is expected (i.e. [[File:...]]).
To add a caption below the image, use Шаблон:Para.
Шаблон:Para Use to place a line such as "Part of the X series on" before the title.
Шаблон:Para Use to place a title for the sidebar at the top of the sidebar. (If Шаблон:Para is used, it will appear immediately below it).
Шаблон:Para Use to place an image between the Шаблон:Para (if used) and first section. As with Шаблон:Para, full wiki syntax is expected (i.e. [[File:...]]).
To add a caption below the image, use Шаблон:Para.
Шаблон:Para
Шаблон:Para
The nth headingШаблон:\content. contentn is required if headingn is also to appear.
Шаблон:Para See #TemplateStyles.

Classes can be used to make styles easier to target for TemplateStyles. Шаблон:Para must be used for this purpose for an entire sidebar (otherwise a page with multiple sidebars may take styles intended only for one sidebar). An example for a template named "Template:Example Sidebar" might have the class Шаблон:Para.

Шаблон:Para and Шаблон:Para can be used to target a specific heading or content group. This should be needed only rarely.

These classes can also be used for microformats.

Шаблон:Para Same as the Шаблон:Para offered by {{Navbox}}.
(Use, for example, to add one or more portal links to the bottom of the template (shown, by default, in bold).)
Шаблон:Para When Шаблон:Para is specified, set to "off", "none", etc. (without quotes) to remove the {{navbar}} links () that otherwise appear at the bottom of the sidebar.

TemplateStyles

[уреди]

Шаблон:Further

The TemplateStyles parameters Шаблон:Para, Шаблон:Para, and Шаблон:Para take the pagename of a TemplateStyles page and turn it into a TemplateStyles tag. The TemplateStyles tag is a much more powerful way to add styling to a sidebar.

Some rules of use:

  1. Always add a template-specific class in Шаблон:Para so that the styles added to one sidebar will not "leak" into another sidebar. For example, Template:DYK tools has Шаблон:Para and the Template:DYK tools/styles.css page targets .dyk-tools for all of its added styling.
  2. Do not assume Template:Sidebar will continue to have a table structure (i.e., do not target table or any other table HTML in the TemplateStyles page). The table structure is soft-deprecated and will go away at some point in the future.

These tags are loaded in this order: Core templatestyles (Module:Sidebar/styles.css), templatestyles, child, and then grandchild, which can be used to 'cascade' the styles.

Шаблон:Para
This parameter is intended for a template or module calling {{sidebar}} directly.
Шаблон:Para
This parameter is intended for a template or module which calls a sidebar with Шаблон:Para.
Шаблон:Para
This parameter is intended for a template or module which calls a sidebar with Шаблон:Para.

The canonical list of classes output with each kind of element of a sidebar (i.e. output for all Шаблон:Para, or all cases of Шаблон:Para) can be found in Module:Sidebar/configuration in the "class" table. The below is a non-authoritative but otherwise sufficient list for most generic styling:

.sidebar
The top-level sidebar class.
.sidebar-outer-title
The class associated with a Шаблон:Para.
.sidebar-top-image
The class associated with a Шаблон:Para.
.sidebar-top-caption
The class associated with a Шаблон:Para.
.sidebar-pretitle
.sidebar-pretitle-with-top-image
The classes associated with a Шаблон:Para. Only one of these will be output per sidebar, depending on whether Шаблон:Para is present.
.sidebar-title
.sidebar-title-with-pretitle
The classes associated with a Шаблон:Para. Only one of these will be output per sidebar, depending on whether Шаблон:Para is present.
.sidebar-image
The class associated with a Шаблон:Para.
.sidebar-caption
The class associated with a Шаблон:Para.
.sidebar-above
The class associated with a Шаблон:Para.
.sidebar-heading
The class associated with a Шаблон:Para. Every heading will have this class.
.sidebar-content
.sidebar-content-with-subgroup
The classes associated with Шаблон:Para. Every content group will have one of these classes, depending on whether the specific content has a subgroup.
.sidebar-below
The class associated with a Шаблон:Para.
.sidebar-navbar
The class associated with a Шаблон:Para.

Example TemplateStyles parameter use

[уреди]

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 (grandchild templates have a similar use):

{{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
}}
[уреди]

{{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 Шаблон:Para is the long link without its square brackets.

Use the Шаблон:Para parameter to turn link wrapping off for the whole template.

Embedding

[уреди]

One sidebar template can be embedded into another using the Шаблон:Para 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 Шаблон:Code field, not a Шаблон: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 Шаблон:Code 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
}}

Deprecated parameters

[уреди]

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

Parameter Explanation
Шаблон:Para Use to alter the default CSS styling set for section headings.
To alter the CSS styling for a specific section's heading, use Шаблон:Para, where n is the number of the section.
Шаблон:Para Use to alter the default CSS styling set for section content.
To alter the CSS styling for a particular section's content, use Шаблон:Para, where n is the number of the section.

Use to alter the default CSS styling for the corresponding parameters.
(Шаблон:Para and Шаблон:Para are applied across the whole sidebar.)

Шаблон:Para 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

[уреди]