Template:MetaCat

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Documentation icon Documentationviewedithistorypurge

This documentation is transcluded from Template:MetaCat/doc.

Use this tag for meta categories only, that should only contain other categories that are grouped by a specified criterion.

The template automatically sets the following categories: Meta categories; depending on the parameters, it may autocategorize into one or more categories. Currently, only specific input makes it autocategorize as this is a work in progress but soon to be generalized.

Usage

{{MetaCat |1= }}

Important: The parameters are case-sensitive because they are used to form category names. Always use lower case unless it's a proper noun.

Template parameters

ParameterDescriptionDefaultStatus
1
criterion it's sorted by (#1)The first parameter is what the member categories sort by, e.g. Books by genre would be genre. Buildings in Canada by year of completion would be {{MetaCat|year of completion}}, not simply {{MetaCat|year}}. The template may autocategorize multiple "by xxx" into the same flat category, like "by year of completion" categories are currently treated the same as the "by year" ones, however, including the full criteria will enable us to easily separate them in the future if desired. The only exception is when there are two criteria, separated by "and" or "or". For example, on Buildings in Moscow by period and style, you would use {{MetaCat|period|style}}. This places it in both Categories by period (flat list) and Categories by style (flat list). In addition, this allows for later combining them (by modifying the template) to create a new flat category if we want.emptyrequired
2criterion it's sorted by (#2)see aboveemptyoptional
topicunused parameteremptyoptional
topic2unused parameteremptyoptional
topic3unused parameteremptyoptional
flatflat listAdd "yes" if it's a "flat list" (contains also the pages in subcategories).
Add "no" to avoid mentioning parent categories.
emptyoptional
topic-catcategoryWill add page to given category with sorting key " {{{1}}}". For example {{MetaCat|industry|topic-cat=Companies of Algeria}} could be used in Category:Companies of Algeria by industryemptyoptional
Template data
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1 or useTemplateData=only on the /doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

Use this tag for ''[[Commons:Meta category|meta categories]] only'', that should ''only'' contain other categories that are grouped by a specified criterion.

<div class="shortcutbox-template plainlinks noprint plainlist" style="float:right; margin:.3em .3em .3em 1em; border:1px solid #ccc; background-color:#fff; padding:0 0.5em; text-align:center; font-size:x-small; line-height:150%"><div lang="en" xml:lang="en" class="description en" style="display:inline;">[//commons.wikimedia.org/w/index.php?title=Special:WhatLinksHere/Template:MetaCat&hidelinks=1&hidetrans=1&namespace=10 <span style="text-decoration:underline;color:black;">Redirect:</span>]</div> <ul> <li>&#123;&#123;[//commons.wikimedia.org/w/index.php?title=Template:Metacat&redirect=no <span style="color: green">Metacat</span>]&#125;&#125;</li>

</ul></div>

Template parameters

ParameterDescriptionTypeStatus
criterion it's sorted by (#1)1

The first parameter is what the member categories sort by, e.g. "Category:Books by genre" would be "genre". "Category:Buildings in Canada by year of completion" would be {{MetaCat|year of completion}}, not simply {{MetaCat|year}}. The template may autocategorize multiple "by xxx" into the same flat category, like "by year of completion" categories are currently treated the same as the "by year" ones, however, including the full criteria will enable us to easily separate them in the future if desired. The only exception is when there are two criteria, separated by "and" or "or". For example, on "Category:Buildings in Moscow by period and style", you would use {{MetaCat|period|style}}. This places it in both "Category:Categories by period (flat list)" and "Category:Categories by style (flat list)". In addition, this allows for later combining them (by modifying the template) to create a new flat category if we want.

Default
empty
Example
empty
Auto value
empty
Stringrequired
criterion it's sorted by (#2)2

see above

Default
empty
Example
empty
Auto value
empty
Stringoptional
flat listflat

Add "yes" if it's a "flat list" (contains also the pages in subcategories).<br /> Add "no" to avoid mentioning parent categories.

Default
empty
Example
empty
Auto value
empty
Stringoptional
topic

unused parameter

Default
empty
Example
empty
Auto value
empty
Unknownoptional
categorytopic-cat

Will add page to given category with sorting key " {{{1}}}". For example {{[[Template:MetaCat|MetaCat]]&#124;industry&#124;topic-cat=Companies of Algeria}} could be used in [[:Category:Companies of Algeria by industry]]

Default
empty
Example
empty
Auto value
empty
Stringoptional
topic2

unused parameter

Default
empty
Example
empty
Auto value
empty
Unknownoptional
topic3

unused parameter

Default
empty
Example
empty
Auto value
empty
Unknownoptional

Additional information

The template is intended to be used in the following namespaces: the Category namespace

The template is intended to be used by the following user groups: all users

Placement: At the top of the page

See also

More general templates with similar purpose:

  • {{Categorise}} – Use this just for tagging main categories requiring permanent control; that is use on (non-meta) main categories that also shouldn't contain files directly (or very little).
  • {{CatDiffuse}} – temporary tag when a category needs files sorted into subcategories because it's overcrowded.
  • {{CatCat}} – Used when a category should only contain other categories, but is not part of a Meta-categorization schema of 'XXX by YYY' form.
  • {{ValiCat}} – Used when a category should only contain subcategories like "Valid SVG created with" or "Invalid SVG created with"
in general…
For categories to get sorted once use {{CatDiffuse}}, for metacategories ("by country", "by name" etc.) use {{MetaCat}} or its more specialized variants.

Localization

العربية | Boarisch | Беларуская (тарашкевіца)‎ | বাংলা | Català | Čeština | Dansk | Deutsch | English | Esperanto | Español | فارسی | Suomi | Français | Galego | Hrvatski | Magyar | Italiano | 日本語 | 한국어 | Lëtzebuergesch | Македонски | മലയാളം | Nederlands | Occitan | Polski | Português | Português do Brasil | Română | Русский | Sicilianu | Slovenčina | Slovenščina | Svenska | Українська | 中文 | 中文(简体)‎ | 中文(繁體)‎ | +/−

This template is localized through {{Autotranslate}}. The layout of the template can be found under Template:MetaCat/layout.

To add your language to the list of languages supported by this template, please copy the code of Template:MetaCat/en (or any other language version you prefer to translate) and replace the text strings in there (the form below can be used to create a translation, the English version is preloaded in the edit box). Please change the parameter lang from en (or whatever language you are translating) to the language code of your language.