This page is protected against editing.

Template:MetaCat

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
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.
  • Categories by ... (flat list) (in one of those)

Usage

{{MetaCat |1= }}

Or use the shorthand
{{metacat|… parameters as described …}}

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
1criterion 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
topicdeprecated  (but still in use (with no functionality) in many categories, should be updated to topic-cat in most cases)emptydeprecated
topic2deprecated  (but still in use (with no functionality) in many categories)emptydeprecated
topic3deprecated  (but still in use (with no functionality) in many categories)emptydeprecated
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 industry
emptyoptional
typetypetype of items, if not "file" (e.g. module, template, ...)emptyoptional
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 meta categories only, that should *only* contain other categories that are grouped by a specified criterion.

Template parameters[Edit template data]

This template prefers inline formatting of 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.

Stringrequired
criterion it's sorted by (#2)2

see above

Stringoptional
flat listflat

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

Stringoptional
topic

"deprecated" (but still in use (with no functionality) in many categories, should be updated to "topic-cat" in most cases)

Unknowndeprecated
categorytopic-cat

Will 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 industry"

Stringoptional
topic2

"deprecated" (but still in use (with no functionality) in many categories)

Unknowndeprecated
topic3

"deprecated" (but still in use (with no functionality) in many categories)

Unknowndeprecated
typetype

type of items, if not "file" (e.g. "module", "template", ...)

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:

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  Bahasa Indonesia  italiano  日本語  한국어  Lëtzebuergesch  македонски  മലയാളം  မြန်မာဘာသာ  Nederlands  norsk nynorsk  polski  português  português do Brasil  română  русский  sicilianu  slovenčina  slovenščina  svenska  Türkçe  українська  中文  中文(简体)  中文(繁體)

This template makes use of {{Autotranslate}} and the translate extension. The layout of the template can be found under Template:MetaCat/layout.