Template:Sitelink: Difference between revisions
Appearance
Content deleted Content added
added shortlinked flag |
Oops, missed one #if for add subst protection. Below my threshold for testing; if I broke anything, just revert; thanks. |
||
Line 1: | Line 1: | ||
<includeonly>{{ {{{|safesubst:}}}#if:{{{linked|{{{shortlinked|}}}}}}|[[:{{{1|{{{lang|en}}}}}}:{{ {{{|safesubst:}}}#invoke:WikidataIB|getSiteLink|qid={{{qid|{{ {{{|safesubst:}}}Get QID|{{{title|}}}}}}}}|wiki={{ {{{|safesubst:}}}trim|{{{1|{{{lang|en}}}}}}}}wiki|ps=1}}|{{#if: {{{shortlinked|}}}|{{{1|{{{lang|en}}}}}}|{{ {{{|safesubst:}}}#invoke:WikidataIB|getSiteLink|qid={{{qid|{{ {{{|safesubst:}}}Get QID|{{{title|}}}}}}}}|wiki={{ {{{|safesubst:}}}trim|{{{1|{{{lang|en}}}}}}}}wiki|ps=1}}}}]]|{{ {{{|safesubst:}}}#invoke:WikidataIB|getSiteLink|qid={{{qid|{{ {{{|safesubst:}}}Get QID|{{{title|}}}}}}}}|wiki={{ {{{|safesubst:}}}trim|{{{1|{{{lang|en}}}}}}}}wiki|ps=1}}}}</includeonly><noinclude> |
<includeonly>{{ {{{|safesubst:}}}#if:{{{linked|{{{shortlinked|}}}}}}|[[:{{{1|{{{lang|en}}}}}}:{{ {{{|safesubst:}}}#invoke:WikidataIB|getSiteLink|qid={{{qid|{{ {{{|safesubst:}}}Get QID|{{{title|}}}}}}}}|wiki={{ {{{|safesubst:}}}trim|{{{1|{{{lang|en}}}}}}}}wiki|ps=1}}|{{ {{{|safesubst:}}}#if: {{{shortlinked|}}}|{{{1|{{{lang|en}}}}}}|{{ {{{|safesubst:}}}#invoke:WikidataIB|getSiteLink|qid={{{qid|{{ {{{|safesubst:}}}Get QID|{{{title|}}}}}}}}|wiki={{ {{{|safesubst:}}}trim|{{{1|{{{lang|en}}}}}}}}wiki|ps=1}}}}]]|{{ {{{|safesubst:}}}#invoke:WikidataIB|getSiteLink|qid={{{qid|{{ {{{|safesubst:}}}Get QID|{{{title|}}}}}}}}|wiki={{ {{{|safesubst:}}}trim|{{{1|{{{lang|en}}}}}}}}wiki|ps=1}}}}</includeonly><noinclude> |
||
{{documentation}} |
{{documentation}} |
||
</noinclude> |
</noinclude> |
Latest revision as of 05:53, 23 March 2024
This template uses Lua: |
{{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}}
→ Predložak:Naslov na stranom jeziku (Croatian Wikipedia page for this very template)