Template:Search/doc
Jump to navigation
Jump to search
This is a documentation subpage for Template:Search. It contains usage information, categories and other content that is not part of the original Template page. |
This template is a template gadget. It requires the InlineSearch gadget to work, which is loaded automatically when this template is used. |
Use this template to search the wiki and display the results in a wiki page.
See the installation instructions to get it working in your wiki.
Usage
Basic
Markup | Renders as |
---|---|
|
Searching...
|
Advanced
Markup | Renders as |
---|---|
|
Searching...
|
Installation
To install this template in your wiki:
- Create a template with the following markup. You can choose the template name, parameter names and defaults to suit your wiki.
<includeonly><div class="InlineSearch" data-search="{{{1|{{{query|}}}}}}" data-namespace="{{{namespace|}}}" data-limit="{{{limit|}}}" data-sort="{{{sort|}}}" >Searching...</div>[[Category:Gadget:InlineSearch]]</includeonly>
- Create MediaWiki:Gadget-InlineSearch.js with the following code:
/** * InlineSearch allows to search the wiki and display the results in a wiki page * Documentation: https://www.mediawiki.org/wiki/InlineSearch * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-InlineSearch.js */ mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-InlineSearch' );
- Add the following gadget to MediaWiki:Gadgets-definition:
* InlineSearch[ResourceLoader|hidden|default|categories=Gadget:InlineSearch]|InlineSearch.js
Done! Add your template to any page to verify that the installation was successful.
Template data
Use this template to search the wiki and display the results inline
Parameter | Description | Type | Status | |
---|---|---|---|---|
Query | query 1 | Search terms or query | String | required |
Namespace | namespace | Namespace number to search
| Number | optional |
Limit | limit | Max search results to show
| Number | optional |
Sort | sort | Sort criteria for search results
| String | optional |
See also
- es:Plantilla:Buscar - Spanish localization of this template
- User:Sophivorus - Main author of this template