Template:Wp/doc: Difference between revisions
(Updated documentation.) |
|||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
__NOTOC__ | __NOTOC__ | ||
==Usage== | ==Usage== | ||
{{tl|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. | {{tl|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. | ||
Line 8: | Line 6: | ||
The template is useful for easy linking to Wikipedia articles in any of the available Wikipedia language servers. | 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 | There are three parameters – one named and two unnamed. The first unnamed parameter is required. If no parameters at all are entered, the template will output a link to English Wikipedia's main page, with the template's first parameter as its name (<code>{{{1}}}</code>). | ||
The syntax | The syntax for the template is: | ||
{{tlc|wp |''article name'' |'' | {{tlc|wp |''article name'' |''alternative link text'' |lang=''language code''}} | ||
'''NB!''' The ''article name'' (parameter "<code>1</code>") must be placed '''before''' any custom link text (parameter "<code>2</code>"), otherwise they will switch functions. The "<code>lang</code>" parameter is not place sensitive. | '''NB!''' The ''article name'' (parameter "<code>1</code>") must be placed '''before''' any custom link text (parameter "<code>2</code>"), otherwise they will switch functions. The "<code>lang</code>" parameter is not place sensitive. | ||
===Article name=== | |||
''Required'' | |||
* '''<code>1</code>''': The name of the Wikipedia article | * '''<code>1</code>''': The name of the Wikipedia article | ||
This is the parameter for entering the name of the article on Wikipedia, you wish to link to | 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. | ||
;<big>Limitations</big> | ;<big>Limitations</big> | ||
* 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, "{{wp|Hovrätt|lang=sv}}", you have to write <tt>Hovrätt</tt>, and not <tt>Hovratt</tt>, <tt>Hovraett</tt>, or <tt>Court of appeal</tt>). If you want the link to show something other than the article's name, use the ''alternative link text'' parameter. | |||
* 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, "{{wp|Hovrätt|lang=sv}}", you have to write <tt>Hovrätt</tt>, and not <tt>Hovratt</tt>, <tt>Hovraett</tt>, or <tt>Court of appeal</tt>). If you want the link to show something other than the article's name, use the '' | |||
;Usage: | ;Usage: | ||
* <code><nowiki>{{</nowiki>wp|''' | * <code><nowiki>{{</nowiki>wp|'''''article name'''''<nowiki>}}</nowiki></code> | ||
=== | ===Alternative link text=== | ||
''Optional'' | |||
* '''<code>2</code>''': Custom text | * '''<code>2</code>''': Custom text | ||
With this parameter, you can define an | With this parameter, you can define an alternative text string to be shown instead of the Wikipedia article's name. No parameter name needs to be entered. | ||
;<big>Limitations</big> | ;<big>Limitations</big> | ||
* The | * The alternative link text must be placed '''after''' (to the right of) the ''article name'' parameter! | ||
;Usage: | ;Usage: | ||
* <code><nowiki>{{</nowiki>wp| | * <code><nowiki>{{</nowiki>wp|''article name''|'''''alternative link text'''''<nowiki>}}</nowiki></code> | ||
===Wikipedia language=== | |||
''Optional'' | |||
* '''<code>lang</code>''': Wikipedia language code | * '''<code>lang</code>''': Wikipedia language code | ||
The link produced by {{tl|wp}} leads by default to English Wikipedia (en.wikipedia.org). If you want to link to a different language version of Wikipedia | The link produced by {{tl|wp}} leads by default to English Wikipedia (<tt>en.wikipedia.org</tt>). If you want to link to a different 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. | ||
;Usage: | ;Usage: | ||
* <code><nowiki>{{</nowiki>wp| | * <code><nowiki>{{</nowiki>wp|''article name''|''alternative link text''|'''lang='''language code<nowiki>}}</nowiki></code> | ||
==Examples== | |||
===Correct use=== | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Example case !! What you write !! What you see | ! Example case !! What you write !! What you see | ||
|- | |- | ||
| Article name || <code><nowiki>{{wp|Mozilla}}</nowiki></code> || {{wp|Mozilla | | Article name || <code><nowiki>{{wp|Mozilla Foundation}}</nowiki></code> || {{wp|Mozilla Foundation}} | ||
|- | |- | ||
| <code><nowiki>{{wp|Mozilla| | | Alternative link text || <code><nowiki>{{wp|Mozilla Foundation|Mozilla on Wikipedia}}</nowiki></code> || {{wp|Mozilla Foundation|Mozilla on Wikipedia}} | ||
|- | |- | ||
| Language: | | rowspan="3" | Language: English || <code><nowiki>{{wp|Mozilla Foundation}}</nowiki></code> || {{wp|Mozilla Foundation}} | ||
|- | |- | ||
| <code><nowiki>{{wp|Mozilla Foundation|lang=}}</nowiki></code> || {{wp|Mozilla Foundation|lang=}} | |||
|- | |- | ||
| <code><nowiki>{{wp|Mozilla|lang= | | <code><nowiki>{{wp|Mozilla Foundation|lang=en}}</nowiki></code> || {{wp|Mozilla Foundation|lang=en}} | ||
|- | |- | ||
| <code><nowiki>{{wp|Mozilla | | Language: Swedish || <code><nowiki>{{wp|Mozilla Foundation|lang=sv}}</nowiki></code> || {{wp|Mozilla Foundation|lang=sv}} | ||
|- | |- | ||
| | | rowspan="3" | Placement of param "<code>lang</code>" is irrelevant || <code><nowiki>{{wp|lang=sv|Mozilla Foundation|Mozilla on Swedish Wikipedia}}</nowiki></code> || {{wp|lang=sv|Mozilla Foundation|Mozilla on Swedish Wikipedia}} | ||
|- | |- | ||
| <code><nowiki>{{wp|Mozilla Foundation|lang=sv|Mozilla on Swedish Wikipedia}}</nowiki></code> || {{wp|Mozilla Foundation|lang=sv|Mozilla on Swedish Wikipedia}} | |||
|- | |- | ||
| <code><nowiki>{{wp| | | <code><nowiki>{{wp|Mozilla Foundation|Mozilla on Swedish Wikipedia|lang=sv}}</nowiki></code> || {{wp|Mozilla Foundation|Mozilla on Swedish Wikipedia|lang=sv}} | ||
|} | |} | ||
===Incorrect use=== | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Example case !! What you write !! What you see | ! Example case !! What you write !! What you see (error) | ||
|- | |- | ||
| No parameter || <code><nowiki>{{wp}}</nowiki></code> || {{wp}} | | No parameter || <code><nowiki>{{wp}}</nowiki></code> || {{wp}} | ||
Line 87: | Line 81: | ||
| <code><nowiki>{{wp||Mozilla on Wikipedia}}</nowiki></code> || {{wp||Mozilla on Wikipedia}} | | <code><nowiki>{{wp||Mozilla on Wikipedia}}</nowiki></code> || {{wp||Mozilla on Wikipedia}} | ||
|- | |- | ||
| Malplacement of params <code>1</code> and <code>2</code> || <code><nowiki>{{wp| | | Malplacement of params <code>1</code> and <code>2</code> || <code><nowiki>{{wp|Custom link name|Article name}}</nowiki></code> || {{wp|Custom link name|Article name}} | ||
| | |||
|} | |} | ||
Revision as of 12:32, 21 November 2014
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. The first unnamed parameter is required. If no parameters at all are entered, the template will output a link to English Wikipedia's main page, with the template's first parameter as its name ({{{1}}}
).
The syntax for the template is:
{{wp |article name |alternative 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
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 alternative link text parameter.
- Usage
{{wp|article name}}
Alternative link text
Optional
2
: Custom text
With this parameter, you can define an alternative text string to be shown instead of the Wikipedia article's name. No parameter name needs to be entered.
- Limitations
- The alternative link text must be placed after (to the right of) the article name parameter!
- Usage
{{wp|article name|alternative link text}}
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.
- Usage
{{wp|article name|alternative link text|lang=language code}}
Examples
Correct use
Example case | What you write | What you see |
---|---|---|
Article name | {{wp|Mozilla Foundation}} |
Mozilla Foundation |
Alternative link text | {{wp|Mozilla Foundation|Mozilla on Wikipedia}} |
Mozilla on Wikipedia |
Language: English | {{wp|Mozilla Foundation}} |
Mozilla Foundation |
{{wp|Mozilla Foundation|lang=}} |
Mozilla Foundation | |
{{wp|Mozilla Foundation|lang=en}} |
Mozilla Foundation | |
Language: Swedish | {{wp|Mozilla Foundation|lang=sv}} |
Mozilla Foundation |
Placement of param "lang " is irrelevant |
{{wp|lang=sv|Mozilla Foundation|Mozilla on Swedish Wikipedia}} |
Mozilla on Swedish Wikipedia |
{{wp|Mozilla Foundation|lang=sv|Mozilla on Swedish Wikipedia}} |
Mozilla on Swedish Wikipedia | |
{{wp|Mozilla Foundation|Mozilla on Swedish Wikipedia|lang=sv}} |
Mozilla on Swedish Wikipedia |
Incorrect use
Example case | What you write | What you see (error) |
---|---|---|
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|Custom link name|Article name}} |
Article name |
See also
- {{wikipedia}} – simple template for creating a link to English Wikipedia, based on the page name.