Template:Wikipedia: Difference between revisions

Jump to navigation Jump to search
Commenting the conditionals in the source; Adding parameters for alternative link text and for showing a diff to a previous revision; Slightly more elaborate examples
(Using plainlink style class for permalink as well.)
(Commenting the conditionals in the source; Adding parameters for alternative link text and for showing a diff to a previous revision; Slightly more elaborate examples)
Line 1: Line 1:
<span class="plainlinks">[http://{{{lang|en}}}.wikipedia.org/wiki/{{urlencode:{{{1|Main Page}}}|wiki}} {{{1|Main Page}}}]</span> {{#if: {{{oldid|}}} | (<span class="plainlinks">[http://{{{lang|en}}}.wikipedia.org/w/index.php?title={{urlencode:{{{1|}}}|wiki}}&oldid={{{oldid|}}} permalink]</span>) }} [[File:Wikipedia icon 32px.png|15px|alt="Wikipedia article"|link=http://{{{lang|en}}}.wikipedia.org/wiki/{{urlencode:{{{1|Main Page}}}|wiki}}]]<noinclude>
<span class="plainlinks">[http://{{{lang|en}}}.wikipedia.org/wiki/{{urlencode:{{{1|Main Page}}}|wiki}} <!--
-->{{#if: {{{2|}}}  <!-- Is there an alternative text? -->
|  <!-- Yes, there is an alternative text -->
{{{2}}}
|  <!-- No, there is no alternative text -->
{{{1|Main Page}}}
}}]</span> <!--
-->{{#if: {{{oldid|}}} <!-- Is there an oldid parameter? -->
|  <!-- Yes there is an oldid parameter -->
{{#if: {{{diff|}}}  <!-- Is there also a non-empty diff parameter? -->
  | <!-- Yes, there there also a non-empty diff parameter -->
  (<span class="plainlinks">[http://{{{lang|en}}}.wikipedia.org/w/index.php?title={{urlencode:{{{1|Main Page}}}|wiki}}&diff=prev&oldid={{{oldid}}} diff]</span>)
  |  <!-- No, there no diff parameter -->
  (<span class="plainlinks">[http://{{{lang|en}}}.wikipedia.org/w/index.php?title={{urlencode:{{{1|Main Page}}}|wiki}}&oldid={{{oldid}}} permalink]</span>)
}}
}} [[File:Wikipedia icon 32px.png|15px|alt="Wikipedia article"|link=http://{{{lang|en}}}.wikipedia.org/wiki/{{urlencode:{{{1|Main Page}}}|wiki}}]]<noinclude>
{{Informative template|1=
{{Informative template|1=
__NOTOC__
__NOTOC__
Line 7: Line 22:


== Usage ==
== Usage ==
  <nowiki>{{</nowiki>'''wikipedia'''<nowiki>|</nowiki>''page''<nowiki>|</nowiki>''lang=''<nowiki>|</nowiki>''oldid=''<nowiki>}}</nowiki>
  <nowiki>{{</nowiki>'''wikipedia'''<nowiki>|</nowiki>''page title''<nowiki>|</nowiki>''alternative text''<nowiki>|</nowiki>''lang=''<nowiki>|</nowiki>''oldid=''<nowiki>|</nowiki>''diff=''<nowiki>}}</nowiki>


All parameters are optional.
All parameters are optional.


; page:   Page title to link to.
; page title:       Page title to link to. Defaults to '''Main Page'''.


; lang:   Two letter language code to link to another language version than the English one.  The language will not be shown (currently not implemented), but the page title might give a hint.
; alternative text: Alternative text to be shown instead of the page title.


; oldid:   Oldid from the end of the Wikipedia permalink URL to use when linking to a specific article revision.  Can be found through the page history.
; lang:              Two letter language code to link to another language version than the English one.  The language will not be shown (currently not implemented), but the page title might give a hint.
 
; oldid:             Oldid from the end of the Wikipedia permalink URL to use when linking to a specific article revision.  Can be found through the page history.
 
; diff:              If not empty a link to a diff comparing the oldid revision with the previous revision will be shown.


== Examples ==
== Examples ==
  <nowiki>{{wikipedia|FlightGear}}</nowiki>
  <nowiki>See the {{wikipedia|FlightGear}} article on Wikipedia.</nowiki>
{{wikipedia|FlightGear}}
See the {{wikipedia|FlightGear}} article on Wikipedia.
 
<nowiki>See the {{wikipedia|FlightGear|lang=sv}} article on the Swedish Wikipedia.</nowiki>
See the {{wikipedia|FlightGear|lang=sv}} article on Swedish Wikipedia.


  <nowiki>{{wikipedia|FlightGear|lang=sv}}</nowiki>
  <nowiki>The Wikipedia article by the time of the {{wikipedia|release of FlightGear 3.0|oldid=596124837}}.</nowiki>
{{wikipedia|FlightGear|lang=sv}}
The Wikipedia article by the time of the {{wikipedia|release of FlightGear 3.0|oldid=596124837}}.


  <nowiki>{{wikipedia|FlightGear|oldid=596124837}}</nowiki>
  <nowiki>Someone {{wikipedia|FlightGear#History|mentioned the HondaJet take-down request|oldid=611503439|diff=yep}} on Wikipedia.</nowiki>
{{wikipedia|FlightGear|oldid=596124837}}
Someone {{wikipedia|FlightGear#History|mentioned the HondaJet take-down request|oldid=611503439|diff=yep}} on Wikipedia.


== Related templates ==
== Related templates ==

Navigation menu