Template:Wp/doc: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(-)
Line 39: Line 39:
;<big>Wikipedia language code</big>
;<big>Wikipedia language code</big>
The link produced by {{tlf|wp}} leads, by default, to English Wikipedia (<tt>en.wikipedia.org</tt>). If you want to link to another language version of Wikipedia, e.g. Swedish Wikipedia (<tt>sv.wikipedia.org</tt>), you can use this parameter and enter the language code for the Wikipedia you wish to link to. Here's a {{wp|List of Wikipedias|list of Wikipedia language versions}}, complete with current language codes.
The link produced by {{tlf|wp}} leads, by default, to English Wikipedia (<tt>en.wikipedia.org</tt>). If you want to link to another language version of Wikipedia, e.g. Swedish Wikipedia (<tt>sv.wikipedia.org</tt>), you can use this parameter and enter the language code for the Wikipedia you wish to link to. Here's a {{wp|List of Wikipedias|list of Wikipedia language versions}}, complete with current language codes.
;<big>Notes</big>
* The use of interwiki links means, in this case, that the output link will point to the English Wikipedia server, and then be redirected from there to the language server you have specified. If, for example, the template is instructed to produce a link to the article ''Article'' in French Wikipedia, it will produce the link {{code|<nowiki>https://en.wikipedia.org/wiki/fr:Article</nowiki>}}, but when you click it, you will go to the address {{code|<nowiki>https://fr.wikipedia.org/wiki/Article</nowiki>}}.


;<big>Usage</big>
;<big>Usage</big>

Revision as of 21:31, 24 January 2015

Edit-copy green.svg
This is a documentation subpage for Template:Wp.
It contains usage information, categories and other content that is not part of the original template page.

Usage

{{wp}} creates a customized, named interwiki link to a Wikipedia article at the position where you place the template. It is possible to choose a Wikipedia language server and to replace the article's name with a custom link text.

The template is useful for easy linking to Wikipedia articles in any of the available Wikipedia language servers.

Parameters

There are 3 parameters, all unnamed and optional. If no parameters at all are entered, the template will output a link to the English Wikipedia main page.

Syntax

The syntax for the template is:

{{wp |article name |custom link text |language code }}

Optional parameters

1

Article name

This is the parameter for entering the name of the article on Wikipedia, you wish to link to.

Notes
  • The article name has to be written exactly as it is on the Wikipedia page; i.e. with diacritics and not translated (e.g. for the Swedish Wikipedia article on the Swedish judicial system's courts of appeal, "Hovrätt", you have to write Hovrätt, and not Hovratt, Hovraett, or Court of appeal). If you want the link to show something other than the article's name, use the custom link text parameter.
Usage
  • {{wp|1}}

2

Custom link text

With this parameter, you can define an custom text string to be shown instead of the Wikipedia article's name. No parameter name needs to be entered.

Notes
  • To skip this parameter, and only use the 1st and the 3rd parameters, leave it empty by typing two pipes in a row.
Example: The syntax is 1st param|(empty)|3rd param; looks like this: Article||language.
Usage
  • {{wp|1|2}}

3

Wikipedia language code

The link produced by {{wp}} leads, by default, to English Wikipedia (en.wikipedia.org). If you want to link to another language version of Wikipedia, e.g. Swedish Wikipedia (sv.wikipedia.org), you can use this parameter and enter the language code for the Wikipedia you wish to link to. Here's a list of Wikipedia language versions, complete with current language codes.

Notes
  • The use of interwiki links means, in this case, that the output link will point to the English Wikipedia server, and then be redirected from there to the language server you have specified. If, for example, the template is instructed to produce a link to the article Article in French Wikipedia, it will produce the link https://en.wikipedia.org/wiki/fr:Article, but when you click it, you will go to the address https://fr.wikipedia.org/wiki/Article.
Usage
  • {{wp|1|2|3}}

Examples

Example case What you write What you see
Article name {{wp|Mozilla Foundation}} Mozilla Foundation
Custom link text {{wp|Mozilla Foundation|Mozilla on Wikipedia}} Mozilla on Wikipedia
English is the default language {{wp|Mozilla Foundation}} Mozilla Foundation
Choose language: French {{wp|Mozilla Foundation||fr}} Mozilla Foundation

See also

  • {{wikipedia}}: simple template for creating a link to English Wikipedia, based on the page name.