Template:Year by category
|
This template is used on approximately 75,000 pages, so changes to it will be widely noticed. Please test any changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Please consider discussing changes on the talk page before implementing them. |
Purpose[edit source]
This template is intended to be used in year-based categories where the year is the first thing in the category name (for example, 2008 in Canadian music or 1979 disasters). It creates a "timeline" style table of links to categories for adjacent years before or after it in the same decade (see example below).
Syntax[edit source]
{{Year by category | m = | c = | d = | y = | cat = | in = | parent = | subcat = | sortkey = }}
Parameters[edit source]
The first 5 parameters split the name of the category page receiving the template into separate pieces. They are used to form the timeline links.
- m = millennium digit
- c = century digit
- d = decade digit
- y = year digit
- The single-digit values of these 4 parameters, taken together ("mcdy"), form the four-digit year. If the year is before 1000 (and thus only 3 digits long) or even earlier, parameters can be omitted, as necessary.
- cat = category name suffix
- The portion of the category name after the year, including the word "in" if present.
The next parameter can be used to link to a "main article" for the category.
- in = see also article name suffix
- Optional: Adds a "see also" link to a closely related "year-in" article. This suffix should not contain the year or the word "in", which is provided by the template itself.
The rest of the parameters are used to categorize the page containing the template.
- parent = parent category name
- Optional: Full name (not including "Category:" prefix) of the category into which this category and similar categories for other years will all be placed (typically, but not always, named something like "topic by year"). Note that a sortkey is not used, so the sorting will be by year.
- subcat = different category name
- Optional: The full name (not including the "Category:" prefix) of another appropriate parent category, typically for the same year. If omitted, the current category will be placed in the category for the year itself, using the value of the "cat" parameter as the sortkey (note that this will not be acceptable if the value of "cat" begins with the word "in").
- sortkey = category sortkey text
- The sortkey used on the category link created by the previous parameter. If "subcat" is used but "sortkey" is not specified, a blank sortkey will be used.
Note that both the "parent" and "subcat" parameters are referring to parent categories of the category page the template is being placed on.
Examples[edit source]
Using all parameters[edit source]
When placed on the page Category:2008 in Canadian music:
{{Year by category | m = 2 | c = 0 | d = 0 | y = 8 | cat = in Canadian music | in = Canadian music | parent = Canadian music by year | subcat = 2008 in Canada | sortkey = Music }}
- displays the following "timeline" and "see also" article link:
- 2003
- 2004
- 2005
- 2006
- 2007
- 2008
- 2009
- 2010
- 2011
- 2012
- 2013
- places the page into Category:Canadian music by year (sorted by year) and Category:2008 in Canada (using the sortkey "Music", which is appropriate since everything in the latter category already pertains to 2008 and Canada)
Using some parameters[edit source]
When placed on the page Category:1999 disasters:
{{Year by category | m = 1 | c = 9 | d = 7 | y = 9 | cat = disasters | parent = 20th-century disasters }}
- displays the following "timeline" (note that the last year isn't linked, since it would be a reference to the same category the template is on):
- 1974
- 1975
- 1976
- 1977
- 1978
- 1979
- 1980
- 1981
- 1982
- 1983
- 1984
- places the page into Category:20th-century disasters (sorted by year) and (since "subcat" wasn't specified) Category:1979 (using the sortkey "disasters")
Subtemplate[edit source]
See also[edit source]
- {{Navseasoncats}} — produces a navigation bar for any category that includes a year, decade, ordinal, or "season" (e.g. 2018–19) anywhere in its name, and identifies that year/decade/ordinal/season automatically without needing parameters
External links[edit source]
- Template:Year by category at Wikipedia, the free Terran-based encyclopedia that anyone can edit.
The above documentation is transcluded from Template:Year by category/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |