Template:CategoryTOC

From Wikimedia Commons, the free media repository
(Redirected from Template:Category TOC)
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:CategoryTOC/doc.

This template adds a table of contents (TOC) to a category page. It is generally not used for categories containing less than 1,000 total pages.

Usage

{{categoryTOC
 |lang =
 |numerals =
 |uppercase =
 |lowercase =
 |letters =
 |start =
 |end =
 |by =
 |prefix =
}}

Template parameters

ParameterDescriptionDefaultStatus
langlanguage codeThe language code of the alphabet to useenoptional
lang2language code 2The language code of the second alphabet to useemptyoptional
lang3language code 3The language code of the third alphabet to useemptyoptional
numeralsnumeralsSpecifies whether and how numerals are included:
  • group: there is one link for all numerals 0–9
  • separate or yes: each numeral from 0 to 9 has a separate link
  • days: day of month from 1 to 31
  • months: months from 01–12 (displayed as January–December)
  • no: no link
All ranges change be changed from the default values above above using |start=, |end=, and |by=
groupoptional
uppercaseuppercase lettersSpecifies whether there is a link for each uppercase letter from A to Z.yesoptional
lowercaselowercase lettersSpecifies whether there is a link for each lowercase letter from a to z.nooptional
lettersletters at allUse no to hide letters.yesoptional
startnumerals startSpecifies the starting number for numeral ranges.emptyoptional
endnumerals endSpecifies the ending number for numeral ranges.emptyoptional
bycount byIf start= and end= are specified, indicates the step size between numbersemptyoptional
prefixSortkey prefixSpecifies a prefix for the sort keys (will not be included in the labels)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

This template adds a table of contents (TOC) to a category page. It is generally not used for categories containing less than 1,000 total pages.

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
count byby

If start= and end= are specified, indicates the step size between numbers

Numberoptional
numerals endend

Specifies the ending number for numeral ranges.

Numberoptional
language codelang

The language code of the alphabet to use

Default
en
Lineoptional
language code 2lang2

The language code of the second alphabet to use

Lineoptional
language code 3lang3

The language code of the third alphabet to use

Lineoptional
letters at allletters

Use no to hide letters.

Default
yes
Lineoptional
lowercase letterslowercase

Specifies whether there is a link for each lowercase letter from a to z.

Default
no
Lineoptional
numeralsnumerals

Specifies whether numerals are included. One of “group” (there is one line for all numerals 0–9), “separate” (each numeral from 0 to 9 has a separate link), “days” (days of month from 1 to 31) and “no” (no numeral link).

Default
group
Lineoptional
Sortkey prefixprefix

Specifies a prefix for the sort keys (will not be included in the labels)

Lineoptional
numerals startstart

Specifies the starting number for numeral ranges.

Numberoptional
uppercase lettersuppercase

Specifies whether there is a link for each uppercase letter from A to Z.

Default
yes
Lineoptional

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

Relies on:

Examples

{{categoryTOC| }}

renders as:


{{categoryTOC|letters=no|numerals=yes|start=1900|end={{CURRENTYEAR}}|by=10|prefix=+}}

renders as:

See also

Localization

This template is localized by utilizing MediaWiki namespace messages. These can be translated at translatewiki.net (current translations).

The only translatable parts in this template are three MediaWiki pages: MediaWiki:Toc, MediaWiki:Top and MediaWiki:Colon (usually there is no need to translate the latter, but in French, for example, it’s used to insert a space before the colon).