Template:Wp/doc

< Template:Wp
Revision as of 14:09, 21 November 2014 by Lakrits (talk | contribs) (Updated /doc.)
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 four parameters – two named and two unnamed. The first unnamed parameter is required. If no parameters at all are entered, the template will output a link to the English Wikipedia main page, with the template's first parameter as the link name ({{{1}}}).

The syntax for the template is:

{{wp |article name |custom link text |sect=article section/subheader |lang=language code }}

Article name

Required

  • 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. No parameter name needs to be entered.

Limitations
  • 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.
  • This parameter ("1") must be placed before any custom link text (parameter "2"), otherwise they will switch functions.
Usage
  • {{wp|article name}}

Custom link text

Optional

  • 2: Custom 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.

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

Article section/subheader

Optional

  • sect: Article section/subheader title

This parameter allow you to link to a named section of an article, i.e. a subheader or an anchor. Together with the article name it will produde a combined wikilink in the format Article_name#Section_name. Just enter the name of the section, i.e. don't include the number sign (#). That is inserted automatically. As with the article name, this must be entered exactly as it is on the Wikipedia page. The "sect" parameter is not place sensitive.

Usage
  • {{wp|article name|custom link text|sect=section/subheader title}}

Wikipedia language

Optional

  • 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. The "lang" parameter is not place sensitive.

Usage
  • {{wp|article name|custom link text|lang=language code}}

Examples

Correct use

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
Link to an article section {{wp|Mozilla Foundation|Mozilla Corporation on Wikipedia|sect=Mozilla Corporation}} Mozilla Corporation on Wikipedia
English is the default language {{wp|Mozilla Foundation}} Mozilla Foundation
Choose language: Swedish {{wp|Mozilla Foundation|lang=sv}} Mozilla Foundation

Incorrect use

Example case What you write What you see Description
No parameter {{wp}} Wikipedia (en) Param name visible
Empty first param {{wp|}} Wikipedia (en) Unnamed link to Wikipedia's (en) main page
{{wp||Mozilla on Wikipedia}} Mozilla on Wikipedia Links to Wikipedia's (en) main page
Malplacement of params 1 and 2 {{wp|Custom link name|Article name}} Article name Links to the custom text string instead of the desired article
Inserted but empty lang param {{wp|Mozilla Foundation|lang=}} Mozilla Foundation Broken link

See also

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