Template:google/documentation

Wiktionary has built-in support for links to Google Web Search results, but this support is a bit buggy, because it's hacked onto support for interwiki links. (Most notably, it changes spaces to underscores in the link, like in Wiktionary article titles; this alters how Google performs its searches. Also, the built-in support doesn't allow any way to include  or   in searches.) This template offers a better alternative.

Usage
The template is used rather like the built-in support. The first argument is mandatory; it indicates the string to search for. The second argument is optional; if included and non-blank, it indicates the link text. If the second argument is blank, then the first argument is used for this as well. If the second argument is omitted entirely, then "google:" plus the first argument is used for this:



Search type
Unlike the built-in support, the template also supports an optional  parameter:


 * → &larr; (equivalent to )
 * → &larr; (equivalent to )

As above, a second unnamed parameter may be included, with the same functionality as above.

Pipes in search queries
A Google search query can include the pipe character, which serves to indicate a logical disjunction; for example, a Google search for   will pull up pages that contain either the word   or the word   (or both). However, the pipe character has meaning to the MediaWiki syntax (it's used to separate template parameters), so care is needed.


 * [[Image:Symbol oppose vote.svg|20px]] This does not work:  →
 * [[Image:Symbol support vote.svg|20px]] This works:  →
 * (This is a feature of Google: uppercase  is equivalent to  .)
 * [[Image:Symbol support vote.svg|20px]] This works:  →
 * (This uses Wiktionary's template.)
 * [[Image:Symbol oppose vote.svg|20px]] This does not work:  →
 * [[Image:Symbol oppose vote.svg|20px]] This does not work:  →
 * [[Image:Symbol oppose vote.svg|20px]] This does not work:  →
 * [[Image:Symbol oppose vote.svg|20px]] This does not work:  →

Note that none of the above approaches works with the built-in support; for example,  produces no.

Number of results per page
The optional  parameter may be used to specify a number of results per page; for example,   links to http://www.google.com/search?q=search+string&amp;num=30, which shows the first thirty search results.

However, this parameter should be used with care, since it would override any setting the user may have configured in his or her Google preferences.