Jump to content

Template:Sitelink/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Usage: Use ublist.
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
{{lua|Module:WikidataIB}}
{{tlx|Sitelink}} will retrieve the foreign language article title (sitelink) given the Wikidata Qid or local article title. If none is supplied, it uses the current page's Qid.
{{tlx|Sitelink}} will retrieve the foreign language article title (sitelink) given the Wikidata Qid or local article title. If none is supplied, it uses the current page's Qid.


== Usage ==
== Usage ==
{{ublist
{{ublist
| {{tlc| Sitelink{{=}} |lang{{=}} |title{{=}} |linked{{=}} }}
| {{tlc|Sitelink |lang{{=}} |title{{=}} |linked{{=}} |shortlinked{{=}}}}
| {{tlc|Sitelink{{=}} |lang{{=}} |qid{{=}} |linked{{=}} }}
| {{tlc|Sitelink |lang{{=}} |qid{{=}} |linked{{=}} }}
| {{tlc|Sitelink{{=}} |lang{{=}} }}
| {{tlc|Sitelink |lang{{=}} }}
| {{tlc|Sitelink{{=}} |1 |qid{{=}} |linked{{=}} }}
| {{tlc|Sitelink |1{{=}} |qid{{=}} |linked{{=}} }}
}}
}}


== Examples ==
== Parameters ==
{{ublist
| {{para|lang}} – [[ISO-639]] language code of the [[List of Wikipedias#Wikipedia editions|foreign Wikipedia page]] to be interrogated (required; alias: {{para|1}}{{hairspace}})
| {{para|title}} – title of the English Wikipedia page (requred if <var>qid</var> is missing; and only one of <var>qid</var> and <var>title</var> may be specified)
| {{para|qid}} – [[Wikidata]] id (item Q-number) of the wikidata item that the English Wikipedia page is linked to (required if <var>title</var> is missing)
| {{para|linked}} – if present, the foreign Wikipedia title is linked (optional; default is plain text, no link)
| {{para|shortlinked}} - if present, the foreign Wikipedia title is linked but displayed as the language code. This can be used in place of or in conjunction with linked
}}


== Examples ==
* {{tlg|Sitelink|es|qid{{=}}Q43287|code=1|_show_result=1}}
* {{tlg|Sitelink|qid{{=}}Q43287|code=1|_show_result=1}}
* {{tlg|Sitelink|hr|title{{=}}German Empire|code=1|_show_result=1}}


* {{tlg|Sitelink|lang{{=}}es|qid{{=}}Q43287|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>(name of the 'German Empire' article at Spanish Wikipedia, as linked by Wikidata item [[:d:Q43287|Q43287]])</small>
* {{tlg|Sitelink|es|qid{{=}}Q43287|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>(param name not required for ''lang'' as long as it is the first/only unnamed param)</small>
* {{tlg|Sitelink|qid{{=}}Q43287|es|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>(same as above)</small>
* {{tlg|Sitelink|es|Q43287|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>('''fails'''; param name required for ''qid'')</small>
* {{tlg|Sitelink|es|qid{{=}}Q43287|linked{{=}}y|code=1|_show_result=1}}
* {{tlg|Sitelink|qid{{=}}Q43287|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>(English assumed if no ''lang'')</small>
* {{tlg|Sitelink|hr|title{{=}}German Empire|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>({{pval|hr}} is the [[ISO-639]] language code for [[List of Wikipedias#Croatian|Croatian]])</small>
* {{tlg|Sitelink|hr|title{{=}}German Empire|linked{{=}}y|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>(linked to Croatian Wikipedia article)</small>
* {{tlg|Sitelink|hr|title{{=}}German Empire|shortlinked{{=}}y|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>(linked to Croatian Wikipedia article with 'hr' as display link)</small>
* {{tlg|Sitelink|hr|linked{{=}}y|code=1|_show_result=1}} &nbsp; &nbsp; &nbsp; <small>(Croatian Wikipedia page for this very template)</small>
<includeonly>{{Sandbox other||
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
<!-- Categories below this line -->
[[Category:Interwiki link templates]]
[[Category:Interwiki link templates]]
[[Category:Wrapper templates]]
[[Category:Wikipedia formatting templates]]
[[Category:Wikidata templates]]
}}</includeonly>
}}</includeonly>

Latest revision as of 18:25, 15 October 2024

{{Sitelink}} will retrieve the foreign language article title (sitelink) given the Wikidata Qid or local article title. If none is supplied, it uses the current page's Qid.

Usage

[edit]
  • {{Sitelink|lang=|title=|linked=|shortlinked=}}
  • {{Sitelink|lang=|qid=|linked=}}
  • {{Sitelink|lang=}}
  • {{Sitelink|1=|qid=|linked=}}

Parameters

[edit]
  • |lang=ISO-639 language code of the foreign Wikipedia page to be interrogated (required; alias: |1= )
  • |title= – title of the English Wikipedia page (requred if qid is missing; and only one of qid and title may be specified)
  • |qid=Wikidata id (item Q-number) of the wikidata item that the English Wikipedia page is linked to (required if title is missing)
  • |linked= – if present, the foreign Wikipedia title is linked (optional; default is plain text, no link)
  • |shortlinked= - if present, the foreign Wikipedia title is linked but displayed as the language code. This can be used in place of or in conjunction with linked

Examples

[edit]
  • {{Sitelink|lang=es|qid=Q43287}} → Imperio alemán       (name of the 'German Empire' article at Spanish Wikipedia, as linked by Wikidata item Q43287)
  • {{Sitelink|es|qid=Q43287}} → Imperio alemán       (param name not required for lang as long as it is the first/only unnamed param)
  • {{Sitelink|qid=Q43287|es}} → Imperio alemán       (same as above)
  • {{Sitelink|es|Q43287}} →       (fails; param name required for qid)
  • {{Sitelink|es|qid=Q43287|linked=y}}Imperio alemán
  • {{Sitelink|qid=Q43287}} → German Empire       (English assumed if no lang)
  • {{Sitelink|hr|title=German Empire}} → Njemačko Carstvo       (hr is the ISO-639 language code for Croatian)
  • {{Sitelink|hr|title=German Empire|linked=y}}Njemačko Carstvo       (linked to Croatian Wikipedia article)
  • {{Sitelink|hr|title=German Empire|shortlinked=y}}hr       (linked to Croatian Wikipedia article with 'hr' as display link)
  • {{Sitelink|hr|linked=y}} → [[:hr:|]]       (Croatian Wikipedia page for this very template)