Template:Wikidata sitelink/doc
| This is a documentation subpage for Template:Wikidata sitelink. It may contain usage information, categories and other content that is not part of the original template page. |
| This template is used on approximately 92,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
[edit source]| This template uses Lua: |
This template gets the specified interlanguage link for the current article from Wikidata. If not found or a Wikidata item for the article does not exist, it will return an empty string. Use the |lang= parameter to specify an ISO 639-1 language code, and optionally, the |project= parameter if you want to get the link for a project other than Wikipedia. Note that the template will only return the page name, it does not automatically create a link.
See also Template:Interwiki extra for automatically adding links to other languages from a Wikidata item.
Examples
[edit source]Note: On Template:Wikidata sitelink/doc, the result of these examples is empty, as the page is not connected to a Wikidata item. You can see nonempty results when the documentation is transcluded on Template:Wikidata sitelink.
{{Wikidata sitelink|lang=cy}}→ Lua error in Module:WikidataIB at line 482: attempt to index field 'wikibase' (a nil value).{{Wikidata sitelink|lang=cy|project=wikiquote}}→ Lua error in Module:WikidataIB at line 482: attempt to index field 'wikibase' (a nil value).
TemplateData
[edit source]This template gets the specified interlanguage link for the current article from Wikidata. If not found or a Wikidata item for the article does not exist, it will return an empty string.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| lang | lang | ISO 639-1 language code specifying the language you want to get the sitelink for.
| String | required |
| project | project | The project to get the sitelink for, if not Wikipedia.
| String | optional |