Template:Category by year/doc

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

category header to add year navigation box and categorize categories in the "Category:Topic by year" format

Usage

{{Template:Category by year |topic= |year= |label= |prevcat= |nextcat= |prevlabel= |nextlabel= }}

Template parameters

ParameterDescriptionDefaultStatus
topic
1
name of topic from category nameExamplerequired
year
2
year from category namecurrent year using #time:Yrequired
label
3
desired display text for the topic, use only if different from topictopicoptional
prevcat
4
category name to link to for previous year, use only to override automatic calculationemptyoptional
nextcat
5
category name to link to for next year, use only to override automatic calculationemptyoptional
prevlabel
6
desired text to display for previous year, use only if prevcat is used and differentprevcatoptional
nextlabel
7
desired text to display for next year, use only if nextcat is used and differentnextcatoptional
<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.


Wikipedia's help about TemplateDataCommons-specific information

category header to add year navigation box and categorize categories in the "Category:''Topic'' by ''year''" format

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
label 3

desired display text for the topic, use only if different from topic

Default
''topic''
Stringoptional
nextcat 5

category name to link to for next year, use only to override automatic calculation

Stringoptional
nextlabel 7

desired text to display for next year, use only if nextcat is used and different

Default
''nextcat''
Stringoptional
prevcat 4

category name to link to for previous year, use only to override automatic calculation

Stringoptional
prevlabel 6

desired text to display for previous year, use only if prevcat is used and different

Default
''prevcat''
Stringoptional
topic 1

name of topic from category name

Default
Example
Stringrequired
year 2

year from category name

Default
current year using #time:Y
Numberrequired

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: no user group specified

Examples

{{Template:Category by year|topic=Katherine Maher|year=2016}}

renders as:


{{Template:Category by year|topic=Bernie Sanders|year=1991|prevcat=Bernie Sanders before 1991|prevlabel=before 1991}}

renders as:


{{Template:Category by year|topic=Bernie Sanders|year=1991|nextcat=Bernie Sanders after 1991|nextlabel=after 1991}}

renders as:

See also