Template:Gs/doc

From Angelina Jordan Wiki
Revision as of 01:29, 9 August 2022 by Dcljr (talk | contribs) (oops… remove lang= and hide nonworking example)
This is a subpage documenting Template:Gs. To change the template, edit that page; to change the template's documentation (seen below), edit this one.

Documentation

This template provides a convenient way of linking to a Google search. It uses the already existing google: interwiki prefix, but properly urlencodes its input (see examples below for a comparison), and also makes it more obvious that the link is to another website. Pages containing calls to this template (possibly provided by other templates) can be found by using the "WhatLinksHere" feature.

The template does not complain about missing input; instead, it uses the name of the page calling the template as the search query if no other text has been specified, as seen above (the name of this template page is "Gs").

The name of the template is based on the phrase "Google search".

Usage

Common forms (other combinations are possible):

  • {{gs|search string}}
  • {{gs|search string|site=website to search in}}
  • {{gs|search string|linked text}}
  • {{gs|search string|encl=char}}
  • {{gs|search string|open=char|close=char}}

Note that char stands for "character", although these parameter values do not actually need to be single characters (but they usually are).

The encl [referring to "enclosure" or "enclosing character(s)"] and open/close parameters can be used for quotation marks and the like, so these things will appear before the little "leaving the wiki" indicator but outside of the link itself (see examples below). Any combination of these three parameters can be used together (for example, you could use encl and close without open, if that's necessary for some reason).

All parameters

  • {{gs|||site=|open=|close=|encl=}}

Examples

(The fourth example is there just for "completeness": to show the order of the encl and open/close parameters, when used together.)

Other ways of using quotation marks that don't work as well

These last two examples use external links, just for comparison.

The link in the second example is broken at Wikipedia (the relevant article there does not have quotation marks). The first and fourth just look weird. The third and fifth look and work fine, but are tedious to implement (and a bit error-prone).