Template:Commons category: Difference between revisions

From TestWiki
Content added Content deleted
(tweak tracking category logic)
(Call sister project directly rather than going through commons)
Line 1: Line 1:
{{Sister project
{{Commons
| position = {{{position|}}}
| position = {{{position|}}}
| project = commons
<!-- Link -->
| text = Wikimedia Commons has {{{alt-term|media related to}}} '''''[[commons:{{#if:{{{1|}}}|Category:{{{1|}}}|{{if then show|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True}}|Category:{{PAGENAME}}}}}}|<span style="{{#ifeq:{{{nowrap|no}}}|yes|white-space:nowrap;}} {{#ifeq:{{{italic|no}}}|yes|font-style: italic; }}">{{#ifeq:{{{lcf|{{{lcfirst|no}}}}}}|yes|{{lcfirst:{{{2|{{#if:{{{1|}}} | {{{1|}}} <!--
| 1 = <!--
Check for a locally-specified category
-->{{#if:{{{1|}}} | Category:{{{1|}}} <!--
... or use Wikidata
-->|{{if then show|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True}}<!--
... or fall back to the page name
--> |Category:{{PAGENAME}} }} }}
<!-- Display title -->
| 2 = <span style="{{#ifeq:{{{nowrap|no}}}|yes|white-space:nowrap;}} {{#ifeq:{{{italic|no}}}|yes|font-style: italic; }}">{{#ifeq:{{{lcf|{{{lcfirst|no}}}}}}|yes|{{lcfirst:{{{2|{{#if:{{{1|}}} | {{{1|}}} <!--
-->|{{if then show|{{#invoke:String|replace|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True}}|Category:|}}<!--
-->|{{if then show|{{#invoke:String|replace|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True}}|Category:|}}<!--
--> |{{PAGENAME}} }} }} }}} }}<!--
--> |{{PAGENAME}} }} }} }}} }}<!--
Line 16: Line 8:
-->|{{if then show|{{#invoke:String|replace|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True}}|Category:|}}<!--
-->|{{if then show|{{#invoke:String|replace|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True}}|Category:|}}<!--
--> |{{PAGENAME}} }} }} }}}
--> |{{PAGENAME}} }} }} }}}
}}</span>}}<!--
}}</span>]]'''''.<!--
End of the template code, now add relevant tracking categories
End of the template code, now add relevant tracking categories


Line 41: Line 33:
}}
}}
}}
}}
}}</includeonly><noinclude>
}}</includeonly>
}}<noinclude>
{{Documentation}}
{{Documentation}}
<!-- Add categories to the /doc subpage, not here! -->
<!-- Add categories to the /doc subpage, not here! -->

Revision as of 19:38, 22 April 2020