[go: nahoru, domu]

Wikipedia

Protected This template has been protected from editing to prevent vandalism.
Please discuss changes on the talk page or request unprotection.
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:W/doc.

This template is used to help create interwiki links without displaying the prefix, and without the need for repetition if the same page name is to display; understroke characters in the page name are replaced by space characters.

It is also possible to categorize using the (first or second) parameter.

Usage

{{W |1= }}

Template parameters

ParameterDescriptionDefaultStatus
1Page NameAlso specific [sub]pages or name spaces as user, category, talk ...main page of the wikisuggested
2Display Text{{{1}}}optional
3Interwiki Prefixlanguage code (ISO 639-1), and/or sisterproject prefixenoptional
4category request+ or c: categorizes using parameter 1 ("+" or "c" can also be specified with parm 2 or 3)
C: categorizes using parameter 2 (only when it exists; "C" can also be specified with parm 3); c and C enables modification of the parameter
emptyoptional
linklink optioncan change the intended usage of the template to create a link:
  • link=no, link=n, link=- or just link=: returns parameter 2 or 1 as plain text instead of the link
may be useful when the thought page does not (yet) exist
  • link=none: no transclusion - does nothing (but categorization is possible)
  • any other value: is displayed as-it-is; may be a link ({{...}}, [[...]]) or not.
emptyoptional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

This template is used to help create interwiki links without displaying the prefix, <span style="font-weight:normal">and without the need for [[User talk:Perhelion/simpleSVGcheck.js#Link templates|repetition]] if the same page name is to display; understroke characters in the page name are ''replaced'' by space characters.</span>

  • <span style="font-weight:normal">The default template name is simply <code>[[:Template:W|W]]</code> which creates a link to the [[:w:|English Wikipedia]].</span>
  • <span style="font-weight:normal">However any [[:w:List of ISO 639-1 codes|language code]] (>400 [[:Category:Language templates|templates]]) instead of <code>en</code> can be specified in the third parameter.</span>
It is also possible to categorize <span style="font-weight:normal">using the (first or second) parameter.</span>

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Page Name1

Also specific [sub]pages or ''name spaces'' as user, category, talk ...

Default
main page of the wiki
Page namesuggested
Display Text2

Default
{{{1}}}
Lineoptional
Interwiki Prefix3

language code (ISO 639), and/or sisterproject prefix

Default
<code>en</code>
Stringoptional
category request4

+ or c: categorizes using parameter 1 ("+" or "c" can also be specified with parm 2 or 3)<br>C: categorizes using parameter 2 (only when it exists; "C" can also be specified with parm 3); c and C enables [[#Mod|modification]] of the parameter

Unknownoptional
link optionlink

can change the intended usage of the template to create a link:

  • <code>link=no</code>, <code>link=n</code>, <code>link=-</code> or just <code>link=</code>: returns parameter 2 or 1 as plain text instead of the link
may be useful when the thought page does not (yet) exist
  • <code>link=none</code>: no transclusion - does nothing (but categorization is possible)
  • any other value: is displayed as-it-is; may be a link ({{...}}, [[...]]) or not.

    Auto value
    no
Stringoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

See also

{{Ud}} and other Interwiki link templates;


{{WA}} or {{وك}} links to ar:العربية
{{Wb}} links to bn:Wikipedia
{{Wc}} links to cs:Wikipedie
{{WC}} links to ca:Viquipèdia
{{Wd}} links to de:Wikipedia
{{Wda}} links to da:Wikipedia
{{We}} links to es:Wikipedia
{{Wet}} links to et:Vikipeedia
{{Weu}} links to eu:Wikipedia
{{WE}} links to eo:Wikipedia
{{Wf}} links to fr:Wikipédia
{{Wfa}} links to fa:ویکی‌پدیا
{{Wfi}} links to fi:Wikipedia
{{Wg}} links to gl:Wikipedia
{{Wh}} links to hu:Wikipédiá
{{Whe}} links to he:ויקיפדיה
{{Whi}} links to hi:विकिपीडिया
{{Wi}} links to it:Wikipedia
{{Wid}} links to id:Wikipedia
{{Wja}} or {{W}} links to ja:ウィキペディア
{{Wka}} links to ka:ვიკიპედია
{{ವಿ}} links to kn:ವಿಕಿಪೀಡಿಯ
{{Wko}} or {{W말}} links to ko:위키백과
{{വി}} links to ml:വിക്കിപീഡിയ
{{Wlt}} links to lt:Vikipedija
{{Wlv}} links to lv:Vikipēdija
{{Wm}} links to mk:Википедија
{{Wn}} links to nl:Wikipedia
{{Wp}} links to pt:Wikipédia
{{WP}} links to pl:Wikipedia
{{Wr}} links to ru:Википедия
{{වි}} links to si:විකිපීඩියා
{{Wsk}} links to sk:Wikipédia
{{Wsl}} links to sl:Wikipedija
{{Wsr}} links to sr:Википедија
{{Wsu}} links to su:Wikipédia
{{Wsv}} links to sv:Wikipedia
{{Wth}} or {{ว}} links to th:วิกิพีเดีย
{{Wtr}} links to tr:Vikipedi
{{Wu}} links to uk:Вікіпедія
{{Wz}} links to zh:維基百科

The "W××" templates are shortcuts of the main template {{W}}, setting the language code with parameter 3: {{ W××link }} is just {{ Wlink3 = ×× }}
the "W×" templates are abbreviated shortcuts for some very often used languages.

More W× templates are elsewhere in use:
but there are no other language codes starting with "w", so plenty of "W×" templates may be created.

  • {{multilingual link}}

Localization

This template is not intended to be localized.

Recommendation

For linking to a sister project, an internal link such as {{W||en.wikipedia}}) is preferred over an external one as e.g. [http://en.wikipedia.org en.wikipedia].

Category option

Very often one (or more) of the names linked with a W-template are also used for categorizing. As a simplification, the W-template can care for both: the page name or the display text of the Template:W can be also used for this categorizing, by just adding the parameter "+", "c" or "C".

Modification of the "cat" parameter:

When it is not the correct category name, it can be modified:

  • with "+=" a number of characters can be specified to strip on the left of the parameter,
with "-=" to strip from the end of the parameter.
To perform the "+" and/or "-" stripping a module is invoked. When no (+/-)-stripping is needed, use '+' instead of 'c' for less effort.
  • With "h=" or "t=" text can be specified to prefix and/or trail the parameter.

Example: {{W|Toronto|+}} categorizes to Toronto;
{{W|Toronto|+|t=_in_art}} categorizes to Toronto in art

Examples

All parameter combinations

Numbers at line beginning indicate parameter use (0=parameter without value)

000 {{W}}Wikipedia [1]
003 {{W|3=es}}Wikipedia [1] {{We}}: {{ We }} → es:Wp
003 {{W|3=pt}}Wikipedia [1]
020 {{W||Main Page}}Main Page
020 {{W||en:Main Page}}en:Main Page
023 {{W||Ĉefpaĝo|eo}}Ĉefpaĝo
023 {{W||pt:Wikipedia|pt}}pt:Wikipedia {{Wp}}: {{ Wp }} → pt:Wp
023 {{W||pt:Wp|pt}}pt:Wp (preferred style of a link to a national mainpage)
023 {{W||de:Wp|de}}de:Wp {{Wd}}: {{ Wd }} → de:Wp
100 {{W|Page name}}Page name
100 {{Wf|Paris|c}}Paris + [[Category:Paris]]
103 {{W|Page name||it}}Page name {{Wi}}: {{ Wi }} → it:Wp
103 {{W|Page name||fr}}Page name {{Wf}}: {{ Wf }} → fr:Wp
103 {{W|{{FULLPAGENAME}}|3=pl}}Template:W
120 {{W|Page name|Display name}}Display name
123 {{W|Page name|Display name|nl}}Display name {{Wn}}: {{ Wn }} → nl:Wp
123 {{W|Page name|Display name|hu}}Display name {{Wh}}: {{ Wh }} → hu:Wp
  1. a b c It is recommended to use parameter #2 giving an explaining text, as shown in the “023” Main Page examples.


Complex page name examples
3=de de:Wikipedia Benutzer Diskussion:Andreas_06/Spielwiese/Stadien_der_Fußball-Bundesliga
3=fr fr:Wikipédia Discussion aide:Catégorie/Archive3#Appels à volontaires pour Aide à la conception de l'arborescence
3=yi yi:Wikipedia ענדערן הילף:אינהאלט
3=pt pt:Wikipedia Categoria:Cidades fantasmas da CalifórniaPredefinição Discussão:!Info pessoal
3= en:Wikipedia Template talk:Welcome/fr#Pas assez informatif
3=nl:b nl:Wikibooks Scalable Vector Graphics/Stijl
3=en:d en:Wikidata Project chat
3=en:n en:Wikinews Egyptian MP calls for web porn ban
3=fi:q fi:Wikiquote Elizabeth II
3=es:s es:Wikisource Archivo:Las Maravillas Del Cielo pg 7.jpg
3=sv:v sv:Wikiversity Surdegsbakning för hemmabagaren
3=pl:voy pl:Wikivoyage San Francisco
3=lt:wikt lt:Wiktionary Sąrašas:Kinų hieroglifų raktai
3=d 00 Wikidata Property:P4896
3=m 00 Metawiki VisualEditor/Newsletter/2014/November/ka
3=m:de ide:Metawiki Sulzbach an der Murr
3=mw 00 Mediawiki Extension:ParserFunctions/it
3=species 0Wikispecies Verrucaria halizoa
3=en:commons en:Commons Template:W

[edit subpage]

Template {{W}} - examples short Result links to
{{w||en:WP}} {{W}} en:WP en:Main page
{{w|Braille#Lletres i nombres||ca)}} Braille#Lletres i nombres ca:article page
{{w|template:Commonscat||de}} {{Wd|template:Commonscat}} template:Commonscat de:Vorlage:Commonscat
{{w|category:Liste d'artistes||fr}} {{Wf|category:Liste d'artistes}} category:Liste d'artistes fr:Catégorie:Liste d'artistes
{{w|file:Coverkill.jpg||pt}} {{Wp|file:Coverkill.jpg}} file:Coverkill.jpg pt:Ficheiro:Coverkill.jpg
{{w|user:Feketetomi||hu}} {{Wh|user:Feketetomi}} user:Feketetomi hu:Szerkesztő:Feketetomi
{{w|talk:Merano#Rino Gaetano e Merano|3=it)}} {{Wi|talk:Merano#Rino Gaetano e Merano)}} talk:Merano#Rino Gaetano e Merano it:Discussione:Merano
{{w|Carnivora||wikispecies)}} {{W|Carnivora||species)}} Carnivora Wikispecies:Carnivora

In all Wikis, the English namespaces (e.g. file, user) work as well as the different national ones.

{{Multilingual link}} creates a link to Wikipedia article in user's interface language.