Difference between revisions of "Template:Wikipedia"

From Second Life Wiki
Jump to navigation Jump to search
(The "on Wikipedia" trailing words became an alt to the Wikipedia icon (too confusing otherwise))
(Small adaptation, with urlencode, and attempt to give an error if {{{1}}} is not passed. This was tricky to get it right!)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#ifeq:{{{link|}}}|no
{{#if:{{{1<noinclude>|Pagename</noinclude>}}}|
| {{#ifeq:{{{icon|}}}|no
  {{#ifeq:{{{icon|}}}|no
  | <!--empty-->
  | <span style="white-space:nowrap"><!--prevent line wrap between the icon and the link text-->{{#ifeq:{{{text|}}}|no
    | <span style="padding:0 1px">[[File:Wikipedia-16px.png|alt=|link=|w:{{#if:{{{1|}}}|{{{1|}}}:}} {{{2<noinclude>|Article</noinclude>}}}]]</span>&nbsp;
     | <!--empty-->
     | <!--empty-->
     }}
     | [[File:Wikipedia-16px.png|16px|alt="Wikipedia logo"]]&thinsp;<!--
  }}<span style="white-space:normal"><!--allow line wraps between words of the link text, if needed--><bdi>{{#if:{{{3|<noinclude>optional label</noinclude>}}}
-->}}[https://{{#if:{{{lang|}}}|{{{lang|en}}}|{{Langcode|en}}}}.wikipedia.org/wiki/{{urlencode:{{{1}}}|WIKI}} {{{2|{{{1}}}}}}]<!--
  | {{{3|<noinclude>optional label</noinclude>}}}
-->| {{error|1=Missing page name}}<!--
  | {{#ifeq:{{{text|}}}|no
-->}}<noinclude>
    | {{#ifeq:{{{icon|}}}|no
<nowiki>{{Wikipedia|Pagename|display text|icon=no|lang=destination language (currently: </nowiki>{{Langcode|(unknown)}}<nowiki>)}}</nowiki><!--
      | w:{{#if:{{{1|}}}|{{{1|}}}:}}
-->{{Documentation}}</noinclude>
      }}
    }}{{{2<noinclude>|Article</noinclude>}}}}}</bdi></span></span>
| <span class="plainlinks" title="w:{{#if:{{{1|}}}|{{{1|}}}:}}{{{2<noinclude>|Article</noinclude>}}}">[{{FULLURL:w:{{#if:{{{1|}}}|{{{1|}}}:}}{{{2<noinclude>|Article</noinclude>}}}}} {{#ifeq:{{{icon|}}}|no
  | <!--empty-->
  | <span style="white-space:nowrap"><!--prevent line wrap between the icon and the link text-->{{#ifeq:{{{text|}}}|no
    | <span style="padding:0 1px">[[File:Wikipedia-16px.png|alt=|link=|w:{{#if:{{{1|}}}|{{{1|}}}:}}{{{2<noinclude>|Article</noinclude>}}}]]</span>&nbsp;
    | <!--empty-->
    }}
  }}<span style="white-space:normal"><!--allow line wraps between words of the link text, if needed--><bdi>{{#if:{{{3|<noinclude>optional label</noinclude>}}}
  | {{{3|<noinclude>optional label</noinclude>}}}
  | {{{2<noinclude>|Article</noinclude>}}}
  }}</bdi></span></span>]</span>
}}{{#ifeq:{{{text|}}}|no
| <!--empty-->
| &thinsp;[[File:Wikipedia-16px.png|16px|alt={{LangSwitch|lang={{#if:{{{lang|}}}|{{{lang|}}}|{{Langcode}}}}
  | ar = &#32;على ويكيبيديا
  | az = &#32;məqalə Vikipediya
  | bg = &#32;в Уикипедия
  | bn = &#32;উইকিপিডিয়ায়
  | br = &#32;ar Wikipedia
  | bs = &#32;na Wikipediji
  | ca = &#32;a la Viquipèdia
  | co = &#32;supra Wikipedia
  | cs = &#32;na Wikipedii
  | de = &#32;auf Wikipedia
  | ee = &#32;kohta Wikipedia
  | el = &#32;στη Βικιπαίδεια
  | en = &#32;on Wikipedia
  | eo = &#32;ĉe Vikipedio
  | es = &#32;en la Wikipedia
  | eu = &#32;Wikipedian
  | fa = &#32;در ویکی‌پدیا
  | fi = &#32;Wikipediassa
  | fr = &#32;sur Wikipédia
  | he = &#32;בוויקיפדיה
  | hi = &#32;विकिपीडिया पर
  | hr = &#32;na Wikipediji
  | hu = &#32;a Wikipédiában
  | hy = &#32;Վիքիփեդիայում
  | it = &#32;su Wikipedia
  | ja = (Wikipedia)
  | ka = &#32;ვიკიპედია
  | km = &#32;លើវិគីភីឌា
  | ko = (위키백과)
  | lo = &#32;ກ່ຽວກັບວິກິພີເດຍ
  | mk = &#32;на Википедија
  | nl = &#32;op Wikipedia
  | no = &#32;på Wikipedia
  | pl = &#32;w Wikipedii
  | pt = &#32;na Wikipédia
  | ru = &#32;в&nbsp;Википедии
  | sl = &#32;na Wikipediji
  | sq = &#32;në Wikipedia
  | sr = &#32;на Википедиа
  | tr = &#32;Vikipedi’de
  | tl = &#32;sa Wikipedia
  | th = &#32;วิกิพีเดีย
  | uk = &#32;у Вікіпедії
  | ur = &#32;وکی پیڈیا پر
  | yue = 喺維基百科
  | zh-hans = 于维基百科
  | zh-hant = 於維基百科
  }}]]
}}<noinclude>{{Documentation}}</noinclude>

Latest revision as of 18:32, 18 September 2022

"Wikipedia logo"{{{1}}}

{{Wikipedia|Pagename|display text|icon=no|lang=destination language (currently: en)}}

[Edit] [🔄Purge] Template-info.png Template documentation

This template is useful to simply create a link to Wikipedia.

Usage

  • First parameter (mandatory): the actual pagename on Wikipedia (or in the target wiki of the interwiki code specified in the first parameter)
    it is the Pagename in URL "//xx.wikipedia.org/wiki/Pagename");
    note however that this parameter should not be URL-encoded (with overlong %NN%NN sequences) but should readable (in native UTF-8), also preferably with spaces rather than underscores between words.
  • Second parameter: the text to display with the link. If unset, the template displays the title of the page (first parameter).

There are also three named parameters which define whether some parts of the link are shown:

  • lang: language for the destination page (default: current language)
  • icon: if set to no, the template doesn't display the Wikipedia icon;
    any other value (or if the parameter is not specified) will display this icon.

Examples

{{Markup2|m={{Wikipedia|Second Life|Second Life}}|r="Wikipedia logo"Second Life |m1={{Wikipedia|lang=it|OpenStreetMap|OSM}}|r1="Wikipedia logo" [https://it.wikipedia.org/wiki/OpenStreetMap OSM} ]

See also

  • The other, similar Template:WikiIcon, by default, does exactly what it says: draws an icon.
  • Template:Wiki does approximately the same thing as this template (may be merged in the future)