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

From blackwiki
Jump to navigation Jump to search
imported>Funandtrvl
(add)
imported>Vanisaac
m (→‎See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 +
{{lua|Module:Commons link}}
 
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE -->
  
== Purpose ==
+
==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:Commons:Galleries|Commons gallery]] and a [[commons:Commons:Categories|Commons category]]. It is intended for use in the "[[Wikipedia:External links|External links]]" section of an article.
 
Sometimes articles have both Commons articles (galleries) and categories about them. This template can be used to generate an inline link to a [[commons:Commons:Galleries|Commons gallery]] and a [[commons:Commons:Categories|Commons category]]. It is intended for use in the "[[Wikipedia:External links|External links]]" section of an article.
  
== Usage ==
+
==Usage==
This template takes one or two parameters; the Commons gallery and the category (if the category name differs from PAGENAME). Please note that if the Commons gallery (1st parameter) or the Commons category (2nd parameter) is not the same as PAGENAME, then it must be specified and not left blank. There is also an optional parameter for {{para|extratext}}.
+
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===
 
===Format===
:{{tlx|commons and category-inline|<var>CommonsArticleName</var>|<var>CommonsCategoryName</var>}}
+
:{{tlx|Commons and category-inline|<var>CommonsArticleName</var>|<var>CommonsCategoryName</var>}}
  
===Example===
+
===Normal usage===
*{{tlx|commons and category-inline|<var>Ursus maritimus</var>|<var>Ursus maritimus</var>}}
+
<pre>{{Commons and category-inline|Ursus maritimus|Ursus maritimus}}</pre>
 +
{{Commons and category-inline|Ursus maritimus|Ursus maritimus}}
 +
<pre>{{Commons and category}} when placed on Car article (gallery and category both in wikidata):</pre>
 +
{{Commons and category-inline|qid=Q1420}}
 +
<pre>{{Commons and category}} when placed on Beinn an Dòthaidh article (only category in wikidata):</pre>
 +
{{Commons and category-inline|qid=Q4881355}}
 +
<pre>{{Commons and category}} when placed on Samuel Baker House article (only gallery in wikidata):</pre>
 +
{{Commons and category-inline|qid=Q2217963}}
 +
<pre>{{Commons and category}} when placed on Chicago Lawn, Chicago article (neither gallery nor category in wikidata):</pre>
 +
{{Commons and category-inline|qid=Q2963317}}
  
yields:  
+
===Other parameters===
 +
; Full link override
 +
<pre>{{Commons and category-inline|links=[[commons:Foo|]] and [[commons:Category:Bar|Bar]]}}</pre>
 +
{{Commons and category-inline|links=[[commons:Foo|Foo]] and [[commons:Category:Bar|Bar]]}}
  
*{{commons and category-inline|Ursus maritimus|Ursus maritimus}}
+
; List format
 +
<pre>{{Commons and category-inline|list=
 +
* [[commons:Foo|Foo]]
 +
* [[commons:Category:Bar|Bar]]
 +
}}</pre>
 +
{{Commons and category-inline|list=
 +
* [[commons:Foo|Foo]]
 +
* [[commons:Category:Bar|Bar]]
 +
}}
  
== See also ==
+
; Extra text
 +
<pre>{{Commons and category-inline|Ursus maritimus|extratext=&#32;Extra text}} on Ursus maritimus article</pre>
 +
{{Commons and category-inline|Ursus maritimus|qid=Q33609|extratext=&#32;Extra text}}
 +
 
 +
==See also==
 
* [[Template:Commons]]
 
* [[Template:Commons]]
 
* [[Template:Commons-inline]] - shows Commons gallery inline
 
* [[Template:Commons-inline]] - shows Commons gallery inline
 
* [[Template:Commons category]]
 
* [[Template:Commons category]]
 
* [[Template:Commons category-inline]] - shows Commons category inline
 
* [[Template:Commons category-inline]] - shows Commons category inline
* [[Template:Commons category multi]] - to list up to 6 categories.
+
* [[Template:Commons category multi]] - to list up to 6 categories
 
* [[Template:Commons and category]] - shows Commons gallery and category
 
* [[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.
 
* [[Template:Sister project links]] - to link all Wikinews, Wikisource, etc.
 
* {{tl|Wikibooks-inline}}
 
* {{tl|Wikibooks-inline}}
Line 35: Line 61:
 
* [[Wikipedia:Manual of Style/Layout#External links]]
 
* [[Wikipedia:Manual of Style/Layout#External links]]
  
<includeonly>
+
 
 +
<includeonly>{{Sandbox other||
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:Exclude in print]]
 
[[Category:Exclude in print]]
Line 41: Line 68:
 
[[Category:Interwiki link templates]]
 
[[Category:Interwiki link templates]]
 
[[Category:Wikimedia Commons templates]]
 
[[Category:Wikimedia Commons templates]]
</includeonly>
+
}}</includeonly>

Latest revision as of 15:45, 24 April 2020

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