Bản mẫu:w/doc

Từ điển mở Wiktionary
Bước tới điều hướng Bước tới tìm kiếm

This template is for having shorter links to an English Wikipedia article when the link is identical to its label. It had one mandatory parameter, and two optional:

  • {{{1}}}: the page title on Wikipedia to which you wish to link
  • {{{2}}}: the text that the template displays. Default is {{{1}}}
  • lang: the ISO language code of the target Wikipedia. Default is en

A similar effect can be accomplished using the pipe trick: [[w:Chicken|]] is converted to [[w:Chicken|Chicken]] during the pre-save transform, which renders as Chicken. Only one interwiki prefix can be stripped in this way. [[w:fr:Académie française|]] transforms to [[w:fr:Académie française|fr:Académie française]].

Examples[sửa]

just using parameter 1
* {{w|The History of the Decline and Fall of the Roman Empire}}

gives:

using parameters 1 and 2
*{{w|William Shakespeare|Shakespeare}}

gives

also using parameter lang (at any position)
*{{w|William Shakespeare|Shakespeare|lang=fr}}
*{{w|lang=fr|William Shakespeare|Shakespeare}}

gives a link eventually rerouted to the French-speaking Wikipedia

Notes[sửa]

Because of its simplicity, the template can be substituted using subst:

{{subst:w|William Shakespeare|Shakespeare}}

gives

[[w:William Shakespeare|Shakespeare]]

However, substituting

{{subst:w|The History of the Decline and Fall of the Roman Empire}}

gives an unwiedly duplication of content the template is here to avoid in the first place:

[[w:The History of the Decline and Fall of the Roman Empire|The History of the Decline and Fall of the Roman Empire]]