Difference between revisions of "Template:Wikipedia"

From Second Life Wiki
Jump to navigation Jump to search
(Attempt to get valid links using the urlencode magic word)
(Small adaptation, with urlencode, and attempt to give an error if {{{1}}} is not passed. This was tricky to get it right!)
Line 1: Line 1:
  | <!--empty-->
  | [[File:Wikipedia-16px.png|16px|alt="Wikipedia logo"]]<nowiki> </nowiki><!--
    | <!--empty-->
-->}}[{{urlencode:https://{{#if:{{{lang|}}}|{{{lang|en}}}|{{Langcode|en}}}}.wikipedia.org/wiki/{{{1}}}|WIKI}} {{#if:{{{2}}}|{{{2}}}|<!--empty-->}}]<!--
    | [[File:Wikipedia-16px.png|16px|alt="Wikipedia logo"]]&thinsp;<!--
--><noinclude><nowiki>{{Wikipedia|Pagename|display text|icon=no|lang=destination language (currently: </nowiki>{{{lang}}})<nowiki>}}</nowiki><!--
-->}}[https://{{#if:{{{lang|}}}|{{{lang|en}}}|{{Langcode|en}}}}.wikipedia.org/wiki/{{urlencode:{{{1}}}|WIKI}} {{{2|{{{1}}}}}}]<!--
-->| {{error|1=Missing page name}}<!--
<nowiki>{{Wikipedia|Pagename|display text|icon=no|lang=destination language (currently: </nowiki>{{Langcode|(unknown)}}<nowiki>)}}</nowiki><!--

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.


  • 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.


{{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)