Difference between revisions of "Template:Commons and category-inline/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Hike395
(minimize calls to wikidata)
imported>Hike395
(protected by #if, will not get extraneous calls)
Line 4: Line 4:
 
|links={{#if:{{{links|}}}|{{{links|}}}|<!--
 
|links={{#if:{{{links|}}}|{{{links|}}}|<!--
 
           -->{{if then wikilink|{{{1|}}}|<!--
 
           -->{{if then wikilink|{{{1|}}}|<!--
             -->{{if then wikilink|{{WikidataOI|property|{{{qid|}}}|P935|fetch={{is empty|{{{1|}}}}}}}|<!--
+
             -->{{if then wikilink|{{Wikidata|property|{{{qid|}}}|P935}}|<!--
 
                 -->[[Commons:Special:Search/{{PAGENAME}}|{{PAGENAME}}]]|prefix=Commons:}}|prefix=Commons:}}<!--
 
                 -->[[Commons:Special:Search/{{PAGENAME}}|{{PAGENAME}}]]|prefix=Commons:}}|prefix=Commons:}}<!--
 
         --> ([[Commons:{{#if:{{{2|}}}|Special:Search/Category:{{{2}}}|<!--  
 
         --> ([[Commons:{{#if:{{{2|}}}|Special:Search/Category:{{{2}}}|<!--  
             -->{{if then show|{{WikidataOI|property|{{{qid|}}}|P373|fetch={{is empty|{{{2|}}}}}}}|<!--
+
             -->{{if then show|{{Wikidata|property|{{{qid|}}}|P373}}|<!--
 
                   -->Special:Search/Category:{{PAGENAME}}|Category:}}}}|category]])}}
 
                   -->Special:Search/Category:{{PAGENAME}}|Category:}}}}|category]])}}
 
|extratext={{{extratext|}}}
 
|extratext={{{extratext|}}}

Revision as of 03:52, 4 January 2020

16x16px Media related to [[Commons:Template:Wikidata|Template:Wikidata]] ([[Commons:Category:Template:Wikidata|category]]) at Wikimedia Commons

Purpose

Sometimes articles have both Commons articles (galleries) and categories about them. This template can be used to generate an inline link to a Commons gallery and a Commons category. It is intended for use in the "External links" section of an article.

Usage

This template takes two optional parameters: the Commons gallery and the category. If either of these is left blank, the template searches for them in wikidata. There are a number of other optional parameters, described below:

Format

{{Commons and category-inline|CommonsArticleName|CommonsCategoryName}}

Normal usage

{{Commons and category-inline|Ursus maritimus|Ursus maritimus}}

16x16px Media related to Lua error in Module:Commons_link at line 35: attempt to index field 'wikibase' (a nil value). at Wikimedia Commons

{{Commons and category}} when placed on Car article (gallery and category both in wikidata):

16x16px Media related to Lua error in Module:Commons_link at line 41: attempt to index field 'wikibase' (a nil value). at Wikimedia Commons

{{Commons and category}} when placed on Beinn an Dòthaidh article (only category in wikidata):

16x16px Media related to Lua error in Module:Commons_link at line 41: attempt to index field 'wikibase' (a nil value). at Wikimedia Commons

{{Commons and category}} when placed on Samuel Baker House article (only gallery in wikidata):

16x16px Media related to Lua error in Module:Commons_link at line 41: attempt to index field 'wikibase' (a nil value). at Wikimedia Commons

{{Commons and category}} when placed on Chicago Lawn, Chicago article (neither gallery nor category in wikidata):

16x16px Media related to Lua error in Module:Commons_link at line 41: attempt to index field 'wikibase' (a nil value). at Wikimedia Commons

Other parameters

Full link override
{{Commons and category-inline|links=[[commons:Foo|]] and [[commons:Category:Bar|Bar]]}}

16x16px Media related to Foo and Bar at Wikimedia Commons

List format
{{Commons and category-inline|list=
* [[commons:Foo|Foo]]
* [[commons:Category:Bar|Bar]]
}}

16x16px Related media at Wikimedia Commons:

Extra text
{{Commons and category-inline|Ursus maritimus|extratext= Extra text}} on Ursus maritimus article

16x16px Media related to Lua error in Module:Commons_link at line 41: attempt to index field 'wikibase' (a nil value). at Wikimedia Commons Extra text

See also