Template:Wp/doc

From MozillaWiki
< Template:Wp
Revision as of 17:27, 8 November 2014 by Lakrits (talk | contribs) (Created /doc subpage for Template:Wp.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
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 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 three parameters – one named and two unnamed, none of which is strictly mandatory. However, the article name (unnamed parameter "1") is required for the template to be at all useful, and is therefore strongly recommended. If no parameters at all are entered, the template will output an empty, numbered link to English Wikipedia's main page.

The syntax looks like this:

{{wp |article name |alternate link text |lang=language code}}

NB! The article name (parameter "1") must be placed before any custom link text (parameter "2"), otherwise they will switch functions. The "lang" parameter is not place sensitive.

Article name

  • 1: The name of the Wikipedia article

This is the parameter for entering the name of the article on Wikipedia, you wish to link to. It is not a mandatory parameter, but highly recommended. No parameter name needs to be entered.

Limitations
  • For some reason, the template cuts at the first space character in the article name. If the article has more than one word in its name, you need to replace the spaces with underscores ("_"), and then use the alternate link text parameter to show the article name with spaces.
  • 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 alternate link text parameter.
Usage
  • {{wp|1}}

Alternate link text

  • 2: Custom text

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

Limitations
  • The alternate link text must be placed after (to the right of) the article name parameter!
Usage
  • {{wp|1|2}}

Wikipedia language

  • lang: Wikipedia language code

The link produced by {{wp}} leads by default to English Wikipedia (en.wikipedia.org). If you want to link to a different 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.

Usage
  • {{wp|1|2|lang=language code}}

Examples

Correct use

Example case What you write What you see
Article name {{wp|Mozilla}} Mozilla
Alternate link text {{wp|Mozilla|Mozilla on Wikipedia}} Mozilla on Wikipedia
Language: English {{wp|Mozilla}} Mozilla
{{wp|Mozilla|lang=en}} Mozilla
Language: Swedish {{wp|Mozilla|lang=sv}} Mozilla
Placement of param "lang" is irrelevant {{wp|lang=sv|Mozilla|Mozilla on Swedish Wikipedia}} Mozilla on Swedish Wikipedia
{{wp|Mozilla|lang=sv|Mozilla on Swedish Wikipedia}} Mozilla on Swedish Wikipedia
{{wp|Mozilla|Mozilla on Swedish Wikipedia|lang=sv}} Mozilla on Swedish Wikipedia
Link to Wikipedia page section {{wp|Mozilla#Webmaker|Mozilla Webmaker on Wikipedia}} Mozilla Webmaker on Wikipedia
Underscores in the article name {{wp|Mozilla_Foundation}} Mozilla_Foundation
{{wp|Mozilla_Foundation|Mozilla Foundation}} Mozilla Foundation

Incorrect use

Example case What you write What you see
No parameter {{wp}} Wikipedia (en)
Empty first param {{wp|}} Wikipedia (en)
{{wp||Mozilla on Wikipedia}} Mozilla on Wikipedia
Malplacement of params 1 and 2 {{wp|allizoM|Mozilla}} Mozilla
Spaces in the article name {{wp|Mozilla Foundation|Mozilla, the foundation}} Mozilla, the foundation

See also

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