Difference between revisions of "Template:Cclink"
Jump to navigation
Jump to search
imported>Mike Peel (Add an option for a second parameter for the display name, with fallback to the first parameter if not set.) |
imported>Mike Peel (+ commons icon) |
||
| Line 1: | Line 1: | ||
| − | {{Template for discussion/dated|page=Cclink|link=Wikipedia:Templates for discussion/Log/2016 November 27#Template:Cclink|help=off|bigbox={{#invoke:Noinclude|noinclude|text=yes}}}}<includeonly>[[Commons:Category:{{{1|}}}|{{{2|{{{1|}}}}}}]]</includeonly><noinclude> | + | {{Template for discussion/dated|page=Cclink|link=Wikipedia:Templates for discussion/Log/2016 November 27#Template:Cclink|help=off|bigbox={{#invoke:Noinclude|noinclude|text=yes}}}}<includeonly>{{icon|Commons}} [[Commons:Category:{{{1|}}}|{{{2|{{{1|}}}}}}]]</includeonly><noinclude> |
{{documentation}} | {{documentation}} | ||
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> | <!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> | ||
</noinclude> | </noinclude> | ||
Revision as of 22:05, 30 November 2016
Template:Template for discussion/dated
This is a helper template that displays a linked commons category for use in infoboxes that fetch Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P373) from Wikidata.
Because we don't want to code a huge call to Wikidata twice, for the name of the link and the text to display, we can use this template to use the same text for both.
Usage
Typically inside an infobox definition, something like this:
| label25 = Commons category
| data25 = {{{commons_category | {{#if:{{#property:P373}}| {{cclink | {{#invoke:WikidataIB |getValue |P373 |name=commons_category |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}}}} }} }}}}}
| The above documentation is transcluded from Template:Cclink/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. |