Template:Search/doc

Use this template to search the wiki and display the results in a wiki page.

This template is a template gadget that requires the InlineSearch gadget to work. Follow the installation instructions to get it working in your wiki.

Usage edit

Basic edit

Markup Renders as
{{Search|javascript}}
Searching...

Advanced edit

Markup Renders as
{{Search
| query = incategory:JavaScript
| namespace = 2
| limit = 100
| sort = incoming_links_desc
}}
Searching...

Installation edit

To install this template in your wiki:

  1. Create a template with any name and the following markup (you can adjust the parameter names and defaults to suit your wiki):
    <div class="InlineSearch"
    data-search="{{{1|{{{query|}}}}}}"
    data-namespace="{{{namespace|}}}"
    data-limit="{{{limit|}}}"
    data-sort="{{{sort|}}}"
    >Searching...</div>[[Category:InlineSearch.js]]
    
  2. 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' );
    
  3. Add the following gadget to MediaWiki:Gadgets-definition:
    * InlineSearch[ResourceLoader|hidden|default|categories=InlineSearch.js]|InlineSearch.js
    

Done! Add your template to any page to verify that the installation was successful.

Template data edit

Use this template to search the wiki and display the results inline

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Queryquery 1

Search terms or query

Stringrequired
Namespacenamespace

Namespace number to search

Example
2
Numberoptional
Limitlimit

Max search results to show

Default
10
Example
100
Numberoptional
Sortsort

Sort criteria for search results

Suggested values
create_timestamp_asc create_timestamp_desc incoming_links_asc incoming_links_desc last_edit_asc last_edit_desc random relevance
Default
relevance
Example
create_timestamp_asc
Stringoptional

See also edit