Template:Commons category: Difference between revisions

From Ikwipedia
m Reverted edit by Fredddie (talk) to last version by Izno
 
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 2: Line 2:
| position = {{{position|}}}
| position = {{{position|}}}
| project  = commons
| project  = commons
| text    = Wikimedia Commons has {{{alt-term|media related to}}} <span style="font-weight: bold; {{#ifeq:{{{nowrap|no}}}|yes|white-space:nowrap;}} {{#ifeq:{{{italic|yes}}}|yes|font-style: italic;}}">[[commons:{{#if:{{{1|}}}|Category:{{{1|}}}|{{if then show|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True|fallback=False}}|Category:{{PAGENAME}}}}}}|{{#ifeq:{{{lcf|{{{lcfirst|no}}}}}}|yes|{{lcfirst:{{{2|{{#if:{{{1|}}} | {{{1|}}} <!--
| text    = Wikimedia Commons has {{{alt-term|media related to}}}  
  -->|{{if then show|{{#invoke:String|replace|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True|fallback=False}}|Category:|}}<!--
<includeonly><span style="font-weight: bold;">
  --> |{{PAGENAME}} }} }} }}} }}<!--
[[commons:{{#if:{{{1|}}}|Category:{{{1}}}|Category:{{PAGENAME}}}}|{{{2|{{{1|{{PAGENAME}}}}}}}}]]
  -->|{{{2|{{#if:{{{1|}}} | {{{1|}}} <!--
</span>.</includeonly>
  -->|{{if then show|{{#invoke:String|replace|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True|fallback=False}}|Category:|}}|{{PAGENAME}} }}<!--
}}
  -->}}}}}}}]]</span>.<!--
End of the template code, now add relevant tracking categories


--><includeonly>{{#switch:{{NAMESPACE}}||{{ns:14}}=<!--
<noinclude>
Only add tracking categories to articles and categories.
{{Documentation}}
-->{{#if:{{{1|}}}|{{#ifeq:Category:{{replace|{{{1|}}}|_|&#32;}}|{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True|fallback=False}}|<!--
  -->[[Category:Commons category link is on Wikidata]]<!--


  -->|{{#ifeq:{{replace|{{{1|}}}|_|&#32;}}|{{PAGENAME}}|<!--
== Usage ==
  ... the local parameter is the same as the local pagename
This template links to a corresponding category on Wikimedia Commons.
  -->[[Category:Commons category link is defined as the pagename]]{{preview warning|Commons category does not match the Commons sitelink on Wikidata – [[Template:Commons_category#Resolving_discrepancies|please check]]}}<!--


  ... the local parameter is not the pagename
== Parameters ==
  -->|[[Category:Commons category link is locally defined]]{{preview warning|Commons category does not match the Commons sitelink on Wikidata – [[Template:Commons_category#Resolving_discrepancies|please check]]}}}} }}<!--
* '''position''': Position of the link (optional).
* '''alt-term''': Alternate text for the phrase "media related to" (optional).
* '''nowrap''': Set to "yes" to prevent text wrapping (optional).
* '''italic''': Set to "yes" to italicize the link text (optional).
* '''1''': Category name on Commons (optional; defaults to current page name).
* '''2''': Display text (optional; defaults to current page name or specified category name).


  We don't have a locally-defined link
== Example ==
  -->|{{#if:{{#invoke:WikidataIB |getCommonsLink|qid={{{qid|}}}|onlycat=True|fallback=False}}|<!--
<syntaxhighlight lang="wikitext">
{{Sister project
| position = left
| project = commons
| alt-term = images of
| nowrap = yes
| italic = yes
| 1 = Venus in fiction
| 2 = Venus in fiction media
}}
</syntaxhighlight>


  ... so we're using Wikidata
This example would display:
  -->[[Category:Commons category link from Wikidata]]<!--
''Wikimedia Commons has images of ''**Venus in fiction media**
 
== Notes ==
This template is designed for use on pages where a corresponding category exists on Wikimedia Commons.


    <!-- ... or we're using the pagename
    -->|[[Category:Commons category link is the pagename]]{{preview warning|Commons category does not match the Commons sitelink on Wikidata – [[Template:Commons_category#Resolving_discrepancies|please check]]}}
  }}
  }}
  }}</includeonly>
}}<noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
</noinclude>

Latest revision as of 19:41, 6 November 2024


Usage[edit source]

This template links to a corresponding category on Wikimedia Commons.

Parameters[edit source]

  • position: Position of the link (optional).
  • alt-term: Alternate text for the phrase "media related to" (optional).
  • nowrap: Set to "yes" to prevent text wrapping (optional).
  • italic: Set to "yes" to italicize the link text (optional).
  • 1: Category name on Commons (optional; defaults to current page name).
  • 2: Display text (optional; defaults to current page name or specified category name).

Example[edit source]

{{Sister project
| position = left
| project = commons
| alt-term = images of
| nowrap = yes
| italic = yes
| 1 = Venus in fiction
| 2 = Venus in fiction media
}}

This example would display: Wikimedia Commons has images of **Venus in fiction media**

Notes[edit source]

This template is designed for use on pages where a corresponding category exists on Wikimedia Commons.