Template:Ambox: Difference between revisions
meta>MZMcBride rm spaces after mod to template doc |
meta>Ais523 |
||
Line 7: | Line 7: | ||
| notice = ambox-notice | | notice = ambox-notice | ||
| #default = ambox-notice | | #default = ambox-notice | ||
}} | }}"><tr> | ||
{{#ifeq:{{{image}}}|none| | {{#ifeq:{{{image}}}|none| | ||
<!-- image=none --> | <!-- image=none --> |
Revision as of 16:23, 15 September 2007
File:Info non-talk.png | {{{text}}} |
This template uses Lua: |
Message box meta-templates | |
---|---|
template | context |
{{Ambox}} | article |
{{Cmbox}} | category |
{{Imbox}} | image |
{{Tmbox}} | talk |
{{Fmbox}} | footer / header |
{{Ombox}} | other pages |
{{Mbox}} | auto-detect |
{{Asbox}} | article stub |
{{Dmbox}} | disambiguation |
The {{Ambox}}
template's name derives from Article message box, which is a metatemplate. It is used to build message boxes for templates used in articles, such as {{Cleanup}}
. It offers several different colours, images, and some other features.
Basic usage
The box below shows the most common parameters that are accepted by {{Ambox}}
. The purpose of each is described below.
{{Ambox | name = | subst = <includeonly>{{subst:substcheck}}</includeonly> | small = {{{small|}}} | type = | image = | sect = {{{1|}}} | issue = | talk = {{{talk|}}} | fix = | date = {{{date|}}} | cat = | all = }}
Full usage
The box shows all possible parameters for this template. However, it is not recommended to copy this, because it will never be required to use all of the parameters simultaneously.
{{Ambox | name = | subst = <includeonly>{{subst:substcheck}}</includeonly> | small = {{{small|}}} | type = | image = | imageright = | smallimage = | smallimageright = | class = | style = | textstyle = | sect = {{{1|}}} | issue = | talk = {{{talk|}}} | fix = | date = {{{date|}}} | text = | smalltext = | plainlinks = no | removalnotice = | cat = | all = | cat2 = | all2 = | cat3 = | all3 = }}
Common parameters
name
The name
parameter specifies the name of the template, without the 'Template:' namespace prefix. For example, {{Cleanup}}
specifies it as |name=Cleanup
. This parameter should be updated if the template is ever moved. Its purpose is twofold:
- If incorrectly substituted, it allows the metatemplate to record the name of the template which has been substituted, which may help later editors to correct the problem.
- It allows the template to have a more useful display on its own page, for example to show the date even when not specified, and to apply categorization of the template itself.
subst
The subst
parameter allows the metatemplate to detect whether the template has been incorrectly substituted, and give an appropriate warning if so. It will also add such pages to the Pages with incorrectly substituted templates category. Just copy the value for it exactly as shown here.
small
The small
parameter should be passed through the template, as this will allow editors to use a more compact format by specifying |small=left
on an article:
File:Info non-talk.png | This is the compact (small ), left-aligned Ambox format. |
Otherwise, the standard format will be shown:
File:Info non-talk.png | This is the standard Ambox format. |
Other variations:
- For templates which should never use the compact format, specify
|small=no
or do not pass the small parameter through at all. - For templates which should always use the compact format, just specify
|small=left
. - For templates which should default to the compact format, try
|small={{{small|left}}}
. This will allow an editor to override that choice by supplying|small=no
where they invoke the template.
To use a small box that adjusts its width to match the text, use |style=margin-right: 0; width: auto;
and |textstyle=width: auto;
together:
File:Info non-talk.png | This is the more compact, left-aligned Ambox format with flexible width. |
See the § sect section below for more information on how to limit |small=
use to instances when the template is being used for a section, instead of the whole article (which is recommended, to prevent inconsistent top-of-page display).
type
The type
parameter defines the color of the bar on the box's left edge and the image that is used by default. The type is chosen not on aesthetics, but based on the nature of the information that the box contains. The seven available types and their default images are as follows:
File:Info non-talk.png | type=speedy – Speedy deletion issues, such as pages created by spammers or pages created mistakenly by well-intentioned editors. |
File:Info non-talk.png | type=delete – Deletion issues, such as {{Article for deletion}} and {{Proposed deletion}} . |
File:Emblem-important.svg | type=content – Content issues, such as {{POV}} and objectionable material on pages. |
type=style – Style issues, such as {{Cleanup}} and {{Underlinked}} . |
File:Info non-talk.png | type=notice – Article notices, such as {{Imported}} . |
File:Info non-talk.png | type=move – Merge and split proposals, such as {{Split}} and {{Merge}} . |
File:Info non-talk.png | type=protection – Protection notices, such as {{Pp-vandalism}} and {{Pp-protected}} . |
If the type
parameter is not defined, the template defaults to |type=notice
.
image
You can choose a specific image to use for the template by using the image
parameter. Images are specified using the standard syntax for inserting files on Zoophilia Wiki (see Manual of Style/Images#How to place an image.) Widths of 40–50px work best and are typical, provided its aspect ratio is close to square, and if not it may be advantageous to define its height py prepending an 'x' when specifying its size, as in x40px
. For example:
{{POV}}
specifies|image=[[File:Unbalanced scales.svg|50x40px|class=skin-invert|link=|alt=]]
.File:Unbalanced scales.svg {{{text}}}
{{Underlinked}}
specifies|image=[[File:Ambox wikify.svg|50x40px|class=skin-invert|link=|alt=]]
.{{{text}}} Please note:
- If no image is specified, then the default image corresponding to the value of the
type
parameter is used. (See the § type section above.) - If
|image=none
is specified, then no image is used and the text fills the entire message box area. - If an icon is purely decorative and also in the public domain, accessibility can be improved by suppressing the link to the file page by adding
|link=
and|alt=
to the file link as seen above.
sect
Many article message templates begin with the text This article … and it is often desirable that this wording be altered to read This section … if the template contains information pertaining only to a section of a page instead. The value of this parameter will replace the word "article." Various possibilities for use include:
|sect=list
,|sect=table
,|sect="In popular culture" material
, etc.When using this feature, be sure to remove the words "This article" from the template text, otherwise it will be duplicated.
A common way to facilitate this functionality is to pass
|sect={{{1|}}}
. This will allow editors to type section, for example, as the first unnamed parameter of the template to change the wording. This can be seen at work in{{Advert}}|section
:File:Emblem-important.svg {{{text}}} Another approach is to pass
|sect={{{section|{{{sect|}}}}}}
to provide a named value. Another is to use{{Yesno}}
to parse true values to a boolean option and pass|sect=section
if true.These approaches can be combined, and this is recommended. The following ready-to-use code…
…provides multiple benefits:
- Any positive value that
{{Yesno}}
can detect will be used with the named parameter in the{{Ambox}}
-based template to read "section" instead of "article":|section=y
,|sect=true
, etc. It is recommended to allow both|sect=
and|section=
so that editors do not have to guess which one will work, as sample code above does. - Any other value passed, in any manner, will replace "article":
|section and its subsections
,|1=list
,|sect=section
,|section=table
, etc.
It is also advisable to restrict use of the
|small=
parameter so that it is made contingent upon the template being applied to a section or some other subset of a page rather than the whole article, to prevent the small version of the template from being used at the top of the article, where it would be inconsistent with other article-wide banners:(In this case, any value of
|small=
or|left=
will trigger the small, left display, as long as some value of|sect=
or one of its aliases in that template has also been provided.) This code can be copy-pasted and used with the above code block.issue and fix
The
issue
parameter is used to describe the issue with the article. Try to keep it short and to-the-point (approximately 10–20 words). Thefix
parameter contains some text which describes what should be done to improve the article; it may be longer than the text inissue
, but typically should not exceed two sentences.When the template is in its compact form (as when placed inside
{{Multiple issues}}
) or compact form (when using|small=left
), the value of theissue
parameter is the only text that will be displayed. For example,{{Citation style}}
defines|issue=This article '''has an unclear citation style'''.
|fix=The references used may be made clearer with a different or consistent style of citation, footnoting or external linking.
When used stand-alone it produces:
{{{text}}} But when used inside
{{Multiple issues}}
or with|small=left
it displays only the issue:File:Emblem-important.svg This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages){{{text}}} talk
Some article message templates include a link to the talk page, and allow an editor to specify a section heading to link directly to the relevant section. To achieve this functionality, simply pass the
talk
parameter through, i.e.|talk={{{talk|}}}
.This parameter may then be used by an editor as follows:
|talk=SECTION HEADING
– the link will point to the specified section on the article's talk page, e.g.|talk=Foo
|talk=FULL PAGE NAME
– the template will link to the page specified (which may include a section anchor), e.g.|talk=Talk:Banana#Foo
Notes:
- When this parameter is used by a template, the talk page link will appear on the template itself (in order to demonstrate the functionality) but this will only display on articles if the parameter is actually defined.
- In order to make sure there is always a link to the talk page, you can use
|talk={{{talk|#}}}
. - If the talk page does not exist, there will be no link, whatever the value of the parameter.
date
Passing the
date
parameter through to the metatemplate means that the date that the article is tagged may be specified by an editor. This will be displayed after the message in a smaller font.info
This parameter is for specifying additional information. Whatever you add here will appear after the date, and will not be displayed if the template is being wrapped in
{{Multiple issues}}
.removalnotice
If you specify
|removalnotice=yes
, then the following notice will be displayed after the date and after theinfo
text:This will not be displayed if the template is being wrapped in
{{Multiple issues}}
.cat
This parameter defines a monthly cleanup category. If
|cat=CATEGORY
then:- articles will be placed in Category:CATEGORY from DATE if
|date=DATE
is specified. - articles will be placed in Category:CATEGORY if the date is not specified.
For example,
{{No footnotes}}
specifies|cat=Articles lacking in-text citations
and so an article with the template{{No footnotes}}|date=11 2024
will be placed in Category:Articles lacking in-text citations from 11 2024]].The value of the
cat
parameter should not be wikilinked, nor should the prefix 'Category:' be used.all
The
all
parameter defines a category into which all articles should be placed. Likewise, the value of theall
parameter should not be wikilinked, nor should the prefix 'Category:' be used.Additional parameters
imageright
An image on the right side of the message box may be specified using this parameter. The syntax is the same as for the
image
parameter, except that the default is for no image to be displayed.smallimage and smallimageright
Images for the compact format may be specified using these parameters. They will have no effect unless
|small=left
is specified.class
The
class
parameter defines custom CSS classes to apply to the template. If adding multiple classes, they should be space-delimited (separated by whitespace).style and textstyle
The
style
andtextstyle
parameters define optional CSS style declarations for the template and values should not be wrapped in quotation marks" "
, but with a terminating semicolon;
for each declaration.style
defines the style used by the entire message box. This can be used to do things such as modifying the width of the box, for instance.textstyle
defines the style for only the displayed text.
text and smalltext
Instead of specifying the
issue
andfix
parameters, it is possible to use thetext
parameter with particular attention to the formatting, instead.Customised text for the small format can be defined using the
smalltext
parameter.plainlinks
On Zoophilia Wiki, links to other websites are typically displayed with an arrow icon next to them, like this: example.com. However, in message boxes, that arrow icon is suppressed by default, as in: example.com. To restore the normal style of external link with the arrow icon, use
|plainlinks=no
.cat2, cat3, {Var|all2}} and all3
- The
cat2
andcat3
parameters provide for additional monthly categories, extending the §cat
parameter. - The
all2
andall3
parameters provide for additional categories into which all articles are placed, extending the §all
parameter.
Technical notes
- If you need to use special characters in the
text
parameter, then you need to escape them in the manner shown below…{{Ambox | nocat = true | text = <div>Equal sign = and a start and end brace { } work fine as they are. But here is a pipe | and two end braces }}. And now a pipe and end braces |}}.</div> }}
…which produces…
File:Info non-talk.png Equal sign = and a start and end brace { } work fine as they are.
But here is a pipe | and two end braces }}.
And now a pipe and end braces |}}. - The
<div>…</div>
tags that surround the text in the example above are usually not needed, but if the text contains line breaks, then sometimes weird line spacing occurs. This especially happens when using bulleted lists. In such cases, use the<div>…</div>
tags to fix that. - The default images for this metatemplate are in the PNG file format rather than SVG. The main reason for this is that some older web browsers have trouble with the transparent background that MediaWiki renders for SVG images. The PNG images here have hand-optimized, transparent backgrounds so that they appear as intended in all browsers. Note that SVG icons only look somewhat bad in the old browsers, thus such hand-optimization is only worth the trouble for very widely used icons.
- For more technical details, see the talk page and the § See also links below. Since this template works almost exactly like
{{Tmbox}}
,{{Imbox}}
,{{Cmbox}}
and{{Ombox}}
, their talk pages and related pages might also contain additional details.
Display on mobile devices
The MediaWiki developers have been conducting ongoing readability studies on this template on the mobile version of the site. Until further notice, code installed by the developers on the mobile version will generally override what is done here regarding the display and layout of this template. For more information, see MediaWiki:Mobile Page Issues.
TemplateData
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for this template in articles based on this TemplateData.TemplateData for Ambox
Used to build message boxes for templates used in articles
This template prefers block formatting of parameters.
Parameter Description Type Status Template Name name
The name parameter specifies the name of the template, without the Template namespace prefix.
String optional subst subst
Allows the meta-template to detect whether the template has been incorrectly substituted
Unknown optional Small Mode small
The small parameter should be passed through the template, as this will allow editors to use the small format by specifying |small=left on an article.
- Suggested values
no
left
String optional type type
Type of issue the template describes. Defines the colour of the left bar, and the image that is used by default
- Suggested values
speedy
delete
content
style
notice
move
protection
Line optional image image
Image used with the template
File optional sect sect
Parameter that can be used to change the text "this article" to "this section" or something else
- Suggested values
{{{1|}}}
Line optional issue issue
Describes the issue with the article
Content optional fix fix
Describes what should be done to improve the article
Content optional talk talk
no description
- Auto value
{{{talk|}}}
Unknown optional date date
no description
Unknown optional info info
Specifies additional information
Unknown optional removalnotice removalnotice
Displays a notice about when and how to remove the template message
Boolean optional cat cat
Defines a monthly cleanup category
Unknown optional all all
Defines a category into which all articles should be placed
Unknown optional imageright imageright
no description
Unknown optional class class
no description
Unknown optional text text
no description
Unknown optional plainlinks plainlinks
no description
Unknown optional smallimage smallimage
no description
Unknown optional smallimageright smallimageright
no description
Unknown optional textstyle textstyle
no description
Unknown optional style style
no description
Unknown optional smalltext smalltext
no description
Unknown optional cat2 cat2
no description
Unknown optional cat3 cat3
no description
Unknown optional all2 all2
no description
Unknown optional all3 all3
no description
Unknown optional Mbox family
Module:Message box family:There are seven metatemplates in the- {{Ambox}}, for messageboxes on article pages.
- {{Cmbox}}, for messageboxes on category pages.
- {{Imbox}}, for messageboxes on file (image) pages.
- {{Tmbox}}, for messageboxes on talk pages.
- {{Fmbox}}, for header and footer messageboxes.
- {{Ombox}}, for messageboxes on other types of page.
- {{Mbox}}, for messageboxes that are used in different namespaces and change their presentation accordingly.
Closely related metatemplates:
- {{Asbox}}, for messageboxes in article stubs.
- {{Dmbox}}, for messageboxes on disambiguation or set-index pages.
- {{Ivmbox}}, a simple full-width box with default ivory background intended to frame important messages or notices.
Templates intended to be used in conjunction with Mboxes:
- {{Ombox/shortcut}}, an alternative to {{Shortcut}} for use in Mbox templates
See also
- Wikipedia:Article message boxes – The historical style guideline for creating article message boxes.
- If no image is specified, then the default image corresponding to the value of the