Difference between revisions of "Template:Commons and category-inline/sandbox"
imported>Funandtrvl (tst) |
imported>Hike395 (use wikidata commons gallery and/or category before doing commons search) |
||
| Line 1: | Line 1: | ||
| − | + | {{sister-inline | |
| − | |||
| − | |||
|project=commons | |project=commons | ||
|list={{{list|}}} | |list={{{list|}}} | ||
| − | |links={{{links|[[ | + | |links={{if empty|{{{links|}}}|<!-- link to the first non-empty of the links argument (as given) |
| + | -->{{#if:{{{1|}}}|<!-- else if first argument, use as commons page | ||
| + | -->[[Commons:{{{1}}}|{{{1}}}]]|<!-- | ||
| + | -->{{#if:{{wikidata|property|{{{qid|}}}|P935}}|<!-- else if commons gallery from wikidata, use that | ||
| + | -->[[Commons:{{wikidata|property|{{{qid|}}}|P935}}|{{wikidata|property|{{{qid|}}}|P935}}]]|<!-- | ||
| + | -->[[Commons:Special:Search/{{PAGENAME}}|{{PAGENAME}}]]}}}} <!-- else fall back to Commons search | ||
| + | --> ([[Commons:{{#if:{{{2|}}}|Special:Search/Category:{{{2}}}|<!-- if second argument, search for that category | ||
| + | -->{{#if:{{wikidata|property|{{{qid|}}}|P373}}|<!-- else if commons cat from wikidata, use that | ||
| + | -->Category:{{wikidata|property|{{{qid|}}}|P373}}|<!-- else fall back to Commons search for category | ||
| + | -->Special:Search/Category:{{PAGENAME}}}}}}|category]])}} | ||
|extratext={{{extratext|}}} | |extratext={{{extratext|}}} | ||
| − | }} | + | }}<noinclude> |
| + | {{Documentation}} | ||
| + | </noinclude> | ||
Revision as of 23:30, 3 January 2020
Media related to Script error: No such module "If empty". at Wikimedia Commons
| This is the template sandbox page for Template:Commons and category-inline (diff). See also the companion subpage for test cases. |
| This template uses Lua: |
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}}
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):
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):
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):
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):
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]]}}
Media related to Foo and Bar at Wikimedia Commons
- List format
{{Commons and category-inline|list=
* [[commons:Foo|Foo]]
* [[commons:Category:Bar|Bar]]
}}
Related media at Wikimedia Commons:
- Extra text
{{Commons and category-inline|Ursus maritimus|extratext= Extra text}} on Ursus maritimus article
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
- Template:Commons
- Template:Commons-inline - shows Commons gallery inline
- Template:Commons category
- Template:Commons category-inline - shows Commons category inline
- Template:Commons category multi - to list up to 6 categories
- Template:Commons and category - shows Commons gallery and category
- Template:Wikimedia Commons redirect - specialized soft redirect template for Commons
- Template:Sister project links - to link all Wikinews, Wikisource, etc.
- {{Wikibooks-inline}}
- {{Wikinews-inline}}
- {{Wikiquote-inline}}
- {{Wikisource-inline}}
- {{Wikispecies-inline}}
- {{Wikiversity-inline}}
- {{Wiktionary-inline}}
- Wikipedia:Manual of Style/Layout#External links
| The above documentation is transcluded from Template:Commons and category-inline/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |