Template:W/doc

From Angelina Jordan Wiki
Revision as of 16:04, 28 October 2020 by Dcljr (talk | contribs) (rearrange params)
This is a subpage documenting Template:W. 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 an article (or any other page) at Wikipedia (in English or any other language with an existing Wikipedia). It exists mainly to:

  1. save a little typing/space in the simplest cases (compare: [[wikipedia:Norway|Norway]] vs. {{w|Norway}})
  2. make it easier to find pages on which such links are used, via the "WhatLinksHere" feature (there is no way to find interwiki links with a search)
  3. provide a distinct way of indicating that such links leave the wiki, as seen above (by default, interwiki links are not styled like external links)

The template does not complain about missing input; instead it uses the name of the page calling the template as the link target if no Wikipedia article title is specified (as seen above — note that the name of this template page is "W").

Usage

Common forms (other combinations are possible):

  • {{w|Article Title}}
  • {{w|Article Title|linked text}}
  • {{w|Article Title|linked text|site=site name if not Wikipedia}}
  • {{w|Article Title|linked text|accessed=access date}}
  • {{w|lang=prefix|Article Title}}
  • {{w|Article Title|encl=char}}
  • {{w|Article Title|open=char|close=char}}

Note that "Article Title" here refers to the title of an article at Wikipedia, not the title of the wiki article in which the template call is used. And char stands for "character", although these parameter values do not actually need to be single characters (but they usually are).

When used with the accessed parameter, the template acts more like a citation template, appending the text "at Wikipedia" and the access date.

There is no significance to the lang parameter appearing before the Wikipedia article title (the first unnamed parameter) in the fourth form above, except that this mirrors the way interwiki links are formed (e.g., {{w|lang=no|Norske Talenter}} is equivalent to [[wikipedia:no:Norske Talenter|Norske Talenter]]). Note that the value specified for the lang parameter must not end with a colon. This value must be the subdomain of the non-English Wikipedia you want to link to — i.e., the part of the URL before .wikipedia.org (see example below).

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

  • {{w|lang=| | |site=|open=|close=|encl=|accessed=}}

Examples

  • {{w|Willie Nelson}}Willie Nelson
  • {{w|Gloomy Sunday|encl="}} ⇒ "Gloomy Sunday"
  • {{w|Gloomy Sunday|encl="|accessed=2020-10-23}} ⇒ "Gloomy Sunday". Wikipedia. Accessed 2020-10-23.
  • {{w|lang=no|Norske Talenter|open=«|close=»}} ⇒ «Norske Talenter»
  • {{w|lang=no|Norske Talenter|open=«|close=»|encl="}} ⇒ "«Norske Talenter»"
  • {{w|All of Me (John Legend song)|All of Me|encl="}} ⇒ "All of Me"
  • {{w|wikt:acronym|acronym|site=Wiktionary}}acronym

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

Using quotation marks directly

Trying to use quotation marks in or around the template call (without using the encl parameter) doesn't really work:

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).