Template:Commons/sandbox
This is the template sandbox page for Template:Commons (diff). See also the companion subpage for test cases. |
This template is used on approximately 68,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
This template is part of Wikipedia's sister projects. This template links an article to a page on Wikimedia Commons. Without any arguments, the template uses Wikidata to automatically link to an available gallery or category (if gallery is not available). With an argument, the template links to the named gallery.
Usage
[edit]To place this template on the page, type {{Commons|pagename}}, where pagename is the name of a page on Wikimedia Commons (defaults to "{{PAGENAME}}", the end-name of a page where used).
- The optional 2nd parameter gives the displayed link text.
- The
|position=
parameter accepts one keyword,left
, to float the box to the left instead of to the right. - To link to a Category, use the related template
{{Commons category|catname}}
, where catname is the name of the category.
Location
[edit]Generally:
- Do not place this template or any box-type template in a section all by itself.
- Do not place this template in a section containing columns without floating left.
- Do not indent this template with colon (:) or a bullet (*) markup.
Specifically:
- In articles, this template should be placed at the top of the last section on the page so that it floats to the right of that section.
- See Wikipedia:Wikimedia sister projects#Where to place links for more information and alternatives.
- In disambiguation pages, this template is usually placed at the top of the page.
- In categories, this template should be grouped with other templates at the beginning of the category introduction. This avoids unnecessary white space as any text is floated around the template boxes.
Defaults
[edit]The pagename defaults to wiki-variable "{{PAGENAME}}", which is the end-name of the page where used. For a Template:Txxx, the {{PAGENAME}} would be the end-name "Txxx". For a Category:Catxxx, that page would have {{PAGENAME}} as the end-name "Catxxx".
The default positioning of the link-box is to the right-side.
Examples
[edit]{{Commons}}
|
produces
{{Commons|Reconquista}}
|
produces
{{Commons|Category:Reconquista}}
|
produces
{{Commons|Reconquista|retaking of the Iberian Peninsula}}
|
produces
{{Commons|Reconquista|position=left}}
|
produces
Template data
[edit]TemplateData for Commons
Creates a small box with a link to a related page on Wikimedia Commons.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Pagename | 1 | The page name on Commons. The article's page name is used as a default. | String | optional |
Showname | 2 | Optional displayed link text. | String | optional |
Position | position | Position to display the box: 'left' floats the box to the left rather than the default which is on the right. | String | optional |
Tracking categories
[edit]Normal categories
[edit]Maintenance categories
[edit]- Category:Commons link is defined as the pagename (16)
- Category:Commons link is locally defined (7,745)
- Category:Commons link is the pagename (17,135)
- Category:Inconsistent wikidata for Commons gallery (0)
See also
[edit]- Wikipedia:Manual of Style/Layout § External links
- {{Commons}}—shows Commons box
- {{Commons-inline}}—shows Commons gallery inline
- {{Commons category}}—shows Commons category box
- {{Commons category-inline}}—shows Commons category inline
- {{Commons category multi}}—to list up to six categories
- {{Commons and category}}—shows Commons box with both gallery and category
- {{Commons and category inline}}—shows Commons gallery and category inline
- {{Copy to Wikimedia Commons}}
- {{Wikimedia Commons redirect}}—specialized soft redirect template for Commons
- {{Wiki category}}—to link to a gallery hosted on Wikipedia
- mw:Manual:Pywikibot/commonscat.py
- {{Sister project links}}—to link all Wikinews, Wikisource, etc.
- {{Wikibooks}} / {{Wikibooks inline}}
- {{Wikinews}} / {{Wikinews inline}}
- {{Wikiquote}} / {{Wikiquote-inline}}
- {{Wikisource}} / {{Wikisource-inline}}
- {{Wikispecies}} / {{Wikispecies-inline}}
- {{Wikiversity}} / {{Wikiversity inline}}
- {{Wikivoyage}} / {{Wikivoyage inline}}
- {{Wiktionary}} / {{Wiktionary-inline}}