සැකිල්ල:google
- පහත දැක්වෙන උපදෙස්, සැකිල්ල:google/documentation හි පිහිටා ඇත. සැකිල්ල:google/documentation]]. [සංස්කරණය]
- ප්රයෝජනවත් සබැඳි: උප පිටු ලැයිස්තුව • සබැඳි • යළි යොමු • transclusions • errors (parser/module) • sandbox
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 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:
{{google|search string}}
→ google:search string{{google|search string|}}
→ search string{{google|search string|link text}}
→ link text
Search type
සංස්කරණයUnlike the built-in support, the template also supports an optional {{{type}}}
parameter:
{{google|type=web|search string}}
→ google web:search string{{google|type=books|search string}}
→ google books:search string ← (equivalent to{{b.g.c.|search string}}
){{google|type=scholar|search string}}
→ google scholar:search string{{google|type=patents|search string}}
→ google patents:search string{{google|type=groups|search string}}
→ google groups:search string{{google|type=news|search string}}
→ google news:search string{{google|type=archive|search string}}
→ google news archive:search string{{google|type=images|search string}}
→ google images:search string{{google|type=blogs|search string}}
→ google blogs:search string{{google|type=video|search string}}
→ google video:search string{{google|type=maps|search string}}
→ google maps:search string{{google|type=finance|search string}}
→ google finance:search string
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 yes|no
will pull up pages that contain either the word yes
or the word no
(or both). However, the pipe character has meaning to the MediaWiki syntax (it's used to separate template parameters), so care is needed.
- This does not work:
{{google|yes|no}}
→ no - This works:
{{google|yes OR no}}
→ google:yes OR no- (This is a feature of Google: uppercase
OR
is equivalent to|
.)
- (This is a feature of Google: uppercase
- This works:
{{google|yes{{!}}no}}
→ google:yes|no- (This uses Wiktionary's
{{!}}
template.)
- (This uses Wiktionary's
- This does not work:
{{google|yes<nowiki>|</nowiki>no}}
→ google:yes|no - This does not work:
{{google|yes|no}}
→ google:yes|no - This does not work:
{{google|yes%7Cno}}
→ google:yes%7Cno - This does not work:
{{google|yes|no}}
→ google:yes|no
Note that none of the above approaches works with the built-in support; for example, [[google:yes{{!}}no]]
produces no.
Number of results per page
සංස්කරණයThe optional {{{num}}}
parameter may be used to specify a number of results per page; for example, {{google|search string|num=30}}
links to http://www.google.com/search?q=search+string&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.