Template:If then wikilink
Jump to navigation
Jump to search
If the first unnamed parameter is not an empty string, the template returns it as a piped wiki-link using the |prefix=
as a namespace or interwiki prefix. Otherwise it returns the second unnamed parameter.
This is only useful when the first parameter is a {{#invoke: }} of a Lua module that may return a value or nothing. Because it uses the {{#invoke: }} just once, it simplifies the coding of infoboxes and reduces the calls to a module.
Example[edit source]
{{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en:}}
→ [[s:en:Lua error in Module:WikidataIB at line 467: attempt to index field 'wikibase' (a nil value). |Lua error in Module:WikidataIB at line 467: attempt to index field 'wikibase' (a nil value). ]]
The above documentation is transcluded from Template:If then wikilink/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |