Template:InfoBox/doc

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages. As this template is widely used in our wiki, it may be protected in which case only staff members can change it. Use the discussion page to propose enhancements or fixes, or to voice your opinion.

This template can be used inside of an {{InfoBox stack}} to display a right-floated infobox in an article. More commonly, however, it is used (without {{InfoBox stack}}) to define other specialized kinds of infobox templates that can be used in articles.

To link to this InfoBox in the article use #infobox.

If this template is being considered for use in an article (or other page outside of the Template: namespace), it is very likely that one of the more specific infobox templates listed at the bottom of this page would be more appropriate.

Parameters

Parameter name Required? Default value Description
info Yes (n/a) Main message to display.
header No (n/a) Optional heading to display above the message.
icon No (n/a) Name of FontAwesome icon to display. (Do not include fa- prefix.)
id No (n/a) Identifier to display to the left of the message, if icon is not used. (Can be text or a small image.)
anchor No (n/a) A target used for hyperlinking. (See test cases below.)
category No (n/a) First category. (See explanation below.)
category2 No (n/a) Second category.
category3 No (n/a) Third category.
catmaskns No Template Mask category link(s) when the template is used on a page in the given namespace.

Either icon or id can be used, but not both. If both are specified, icon will be used and id ignored.

The values of category, category2, and category3 should match the name of an existing category on this wiki, without the Category: prefix. Setting any of these parameters (or catmaskns) is generally only useful when this template is being used to define another template. To be specific, consider that {{InfoBox wikify}} is defined using a call to {{InfoBox}} containing category=Wikify articles. So pages on which {{InfoBox wikify}} is placed will appear in Category:Wikify articles. (Note that the categories that Template:InfoBox wikify itself appears in are listed on Template:InfoBox wikify/doc, as explained on Help:Templates.)

Usage

Typical usage on a regular wiki page:

{{InfoBox|info=Message text|icon=icon-name|header=Heading}}
{{InfoBox|info=Message text|id=identifier|header=Heading}}
When used on a regular page, this template must appear inside of an {{InfoBox stack}}, as seen in the testcases below; multiple {{InfoBox}} templates can be listed inside a single {{InfoBox stack}} call.

All parameters, when defining a template:

{{InfoBox|info=|icon=|header=|category=|category2=|category3=|catmaskns=}}
{{InfoBox|info=|id=|header=|category=|category2=|category3=|catmaskns=}}
When used to define another template, this template must not appear inside of an {{InfoBox stack}}.

See the template's testcases:

Correct

Parameter info containing message to display (the minimum required to get something useful)
Wiki code
{{InfoBox stack
| {{InfoBox|info=Some text}}
}}
Main version
Some text
Sandbox version
Some text


Adding an icon and header
Wiki code
{{InfoBox stack
| {{InfoBox|info=Some text|icon=rocket|header=Some heading}}
}}
Main version

Some heading

Some text
Sandbox version

Some heading

Some text


Parameter anchor containing a hyperlink target (#click_me)
Wiki code
{{InfoBox stack
| {{InfoBox|anchor=click_me|info=Some text}}
}}
Main version
Some text
Sandbox version
Some text


↑ When specifying a header, it's preferable to use the {{InfoBox header}} template, as shown in the next case.


Using a custom id (instead of an icon) and header={{InfoBox header}}
Wiki code
{{InfoBox stack
| {{InfoBox|info=Some text|id=Some id| header={{InfoBox header|Some heading}} }}
}}
Main version
Some heading
Some idSome text
Sandbox version
Some heading
Some id Some text


↑ This gives you a preformatted heading that matches the color scheme of this wiki. The value of id can be either plain (or formatted) text or a small image. Note that either type of header (with or without {{InfoBox header}}) can be used with either icon or id.)

Incorrect

No parameter inside InfoBox stack (Exposes wikicode)
Wiki code
{{InfoBox stack
| {{InfoBox}}
}}
Main version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.
Sandbox version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.


Called in isolation with no parameter, not inside of {{InfoBox stack}} (Error message displayed)
Wiki code
{{InfoBox}}
Main version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.
Sandbox version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.




Called in isolation with info parameter, not inside of {{InfoBox stack}} (Large box, not right-floated)
Wiki code
{{InfoBox|info=Foo}}
Main version
Foo
Sandbox version
Foo




↑ This would not be an error if this template call appeared on a page in the Template: namespace to define a special kind of infobox template — say, "Template:InfoBox foo". This is because {{InfoBox foo}} would need to be called inside an {{InfoBox stack}}.

See also[edit]

The templates below are implemented using {{InfoBox}}. They should also appear in Category:InfoBox templates, which may be more complete than this list.

These templates should be used within an {{InfoBox stack}}. Each should provide its own header parameter, but if necessary {{InfoBox header}} can be used.

Underlined text indicates the default heading provided by header=true for each type of template.

For use in articles
Resources
Article status
For use on talk pages
Talk status
(Note that the simpler {{Talk}} can be used in place of both of these.)
For use on user pages
User info
Babel (spoken-language indicators)