Template:Search box/doc

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

This template may be used to add an input box to let the user search a set of pages, for example archived Talk pages.

Usage

{{search box
 |root =
 |search-break =
 |search-width =
 |search-button-label =
}}

Template parameters

ParameterDescriptionDefaultStatus
rootroot pagePrefix to search pages starting with. For example, if its value is “User talk:Example/Archives”, the template will search in pages starting with User talk:Example/Archives.{{FULLPAGENAME}}optional
nosuffixomit slash suffixIf this parameter is present (either with any value or as blank), there will be no slash appended to the root page title.emptyoptional
search-breakline breakWhether to insert a line break between the search field and the button; “yes” or “no”.nooptional
search-widthwidthWidth of the search field in characters (bare number without any unit)22optional
search-button-labelbutton labelThe text of the search buttonSearchoptional
Template data
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

This template may be used to add an input box to let the user search a set of pages, for example archived Talk pages.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
omit slash suffixnosuffix

If this parameter is present (either with any value or as blank), there will be no slash appended to the root page title.

Lineoptional
root pageroot

Prefix to search pages starting with. For example, if its value is “User talk:Example/Archives”, the template will search in pages starting with User talk:Example/Archives.

Default
{{FULLPAGENAME}}
Page nameoptional
line breaksearch-break

Whether to insert a line break between the search field and the button; “yes” or “no”.

Default
no
Lineoptional
button labelsearch-button-label

The text of the search button

Default
Search
Lineoptional
widthsearch-width

Width of the search field in characters (bare number without any unit)

Default
22
Numberoptional

Additional information

The template is intended to be used in the following namespaces: all talk namespaces and noticeboards

The template is intended to be used by the following user groups: all users

Placement: At the top of the page

See also

Examples

{{search box
 |root= User:84user
 |search-break=no
 |search-width=22
 |search-button-label=Search User:84user with suffix
}}

produces


{{search box
 |root= User:84user
 |nosuffix
 |search-break=no
 |search-width=22
 |search-button-label=Search User:84user with nosuffix ignored
}}

produces


{{search box
 |root= User:84user
 |search-break=no
 |search-width=22
 |search-button-label=Search User:84user with suffix
}}

produces


{{search box
 |root= User:84user
 |nosuffix=
 |search-break=no
 |search-width=22
 |search-button-label=Search User:84user with no suffix
}}

produces


{{search box
 |root= User:84user
 |nosuffix=anything
 |search-break=no
 |search-width=22
 |search-button-label=Search User:84user with no suffix=anything
}}

produces


Wrap the template call in a table to workaround the formatting (see source for details):