Advertisement:
Category:Template documentation pages and Template:CatAutoTOC: Difference between pages
(Created page with "{{template category|description=<span style="float:right"><span style="font-size: 75%;"></span></span><span style="font-size: 75%;">This category contains '''Wikipedia:Templ...") |
(Created page with "<includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->...") |
||
Line 1: | Line 1: | ||
<includeonly><!-- | |||
{{ | # TOC, depending on category size | ||
# <= 100 pages → no TOC | |||
{{ | # 101–1200 pages → {{Category TOC}} | ||
# > 1200 pages → {{Large category TOC}} | |||
{{ | -->{{Category other|<!-- | ||
<!-- | ################################################################################# | ||
[[Category: | #### This is a category page, so generate a TOC if needed. #### | ||
[[Category: | #### #### | ||
#### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### | |||
#### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### | |||
################################################################################# | |||
-->{{CatAutoTOC/core<!-- | |||
-->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- | |||
-->|align = {{{align|}}}<!-- | |||
-->|top = {{{top|}}}<!-- | |||
-->|numerals = {{{numerals|}}}<!-- | |||
-->|uppercase = {{{uppercase|}}}<!-- | |||
-->|lowercase = {{{lowercase|}}}<!-- | |||
-->}}<!-- | |||
-->}}<!-- | |||
-->{{Template other<!-- | |||
-->|<!-- | |||
################################################################################# | |||
#### This page is a template, so categorise it #### | |||
#### in [[Category:Templates using CatAutoTOC]] ... #### | |||
#### #### | |||
#### ... unless it is a /doc, /testcases or /sandbox #### | |||
#### #### | |||
#### There is no point categorising every sub-page of the same template #### | |||
################################################################################# | |||
-->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- | |||
-->|<!-- | |||
### Don't categorise /doc, /testcases or /sandbox pages | |||
-->|<!-- | |||
### Not a /doc, /testcases or /sandbox page, so categorise it | |||
-->[[Category:Templates using CatAutoTOC]]<!-- | |||
-->}}<!-- | |||
-->}}</includeonly><noinclude> | |||
{{Documentation}} | |||
[[Category:Wikipedia CatAutoTOC]] | |||
</noinclude> |
Latest revision as of 19:53, 18 November 2021
This template is used on approximately 610,000 pages, or roughly 1651% of all pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
Lua error in Module:Lua_banner at line 113: attempt to index field 'edit' (a nil value). Adds a Table of Contents (TOC) to a category page if the category's size warrants it.
The size thresholds are:
- <= 100 pages → no TOC
- 101–1200 pages → {{Category TOC}}
- > 1200 pages → {{Large category TOC}}
Usage
{{CatAutoTOC}}
On category pages, {{CatAutoTOC}}
can be placed wherever you want the TOC to be displayed.
On a category header template, it is best placed outside any <includeonly></includeonly>
tags, so that the template is categorised as using CatAutoTOC.
Parameters
No parameters are needed.
However, the parameters available {{Category TOC}} may be supplied, and if CatAutoTOC calls {{Category TOC}}, those parameters will be passed on to {{Category TOC}}.
So e.g. {{CatAutoTOC|align=center}}
will:
- Have no effect if no TOC is generated
- Align to the center if {{Category TOC}} is used
- Have no effect if {{Large category TOC}} is used, because {{Large category TOC}} accepts no parameters
Tracking
Each page using this template is categorised in one of three tracking categories:
- Category:CatAutoTOC generates no TOC
- Category:CatAutoTOC generates standard Category TOC
- Category:CatAutoTOC generates Large category TOC
Templates which transclude {{CatAutoTOC}} are categorised in
- Category:Templates using CatAutoTOC (population: 0)
... but only if the transclusion is outside any <noinclude></noinclude>
tags
Bugs
This template uses the magic word {{PAGESINCATEGORY}}
to count the number of pages in the category. Unfortunately, this function can return wildly erroneous results on some categories which have had many pages added and removed.
This bug is well-known, and has been documented in several places since 2010, including:
In the overwhelming majority of categories, the count is recorded accurately enough to support use of this template. However, there seemed to be some issue with {{PAGESINCATEGORY}}
falsely returning zero in some cases. This is tracked in:
- Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero (population: 0)
As of 19 April 2020, that problem seems to have been fixed by a small but cunning tweak[1] to how {{PAGESINCATEGORY}}
is called.
The category should contain only pages labelled as "empty". Template:Purge page
See also
Pages in category "Template documentation pages"
The following 190 pages are in this category, out of 190 total.
A
B
C
- Template:CatAutoTOC/doc
- Template:Category handler/doc
- Template:Citation/doc
- Template:Cite book/doc
- Template:Cite magazine/doc
- Template:Cite news/doc
- Template:Cite press release/doc
- Template:Cite web/doc
- Template:Cmbox/doc
- Template:Collapsible option/doc
- Template:Color/doc
- Template:Comma separated entries/doc
- Template:Commons category/doc
- Template:CSS3 multiple column layout/doc
D
E
F
H
I
- Template:If empty/doc
- Template:Imbox/doc
- Template:IMDb name/doc
- Template:IMDb title/doc
- Template:Improve documentation/doc
- Template:Increase/doc
- Template:Indented plainlist/doc
- Template:Infobox album/color/doc
- Template:Infobox album/doc
- Template:Infobox album/doc/type/doc
- Template:Infobox album/link/doc
- Template:Infobox animanga/Footer/doc
- Template:Infobox animanga/Header/doc
- Template:Infobox animanga/Print/doc
- Template:Infobox animanga/Video/doc
- Template:Infobox artist/doc
- Template:Infobox baseball biography/doc
- Template:Infobox book/doc
- Template:Infobox brand/doc
- Template:Infobox character/doc
- Template:Infobox comics character/doc
- Template:Infobox company/doc
- Template:Infobox concert/doc
- Template:Infobox film/doc
- Template:Infobox football biography/doc
- Template:Infobox historic site/doc
- Template:Infobox hospital/doc
- Template:Infobox Korean name/doc
- Template:Infobox music genre/doc
- Template:Infobox musical artist/color/doc
- Template:Infobox musical artist/doc
- Template:Infobox officeholder/doc
- Template:Infobox online service/doc
- Template:Infobox Organization/doc
- Template:Infobox organization/doc
- Template:Infobox person/doc
- Template:Infobox person/Wikidata/doc
- Template:Infobox product/doc
- Template:Infobox professional wrestler/doc
- Template:Infobox record label/doc
- Template:Infobox settlement/columns/doc
- Template:Infobox settlement/doc
- Template:Infobox song/doc
- Template:Infobox song/link/doc
- Template:Infobox television/doc
- Template:Infobox video game series/doc
- Template:Infobox video game/doc
- Template:Infobox website/doc
- Template:Infobox/doc
- Template:Instagram/doc
- Template:ISSN link/doc
- Template:Italic title/doc
M
N
P
R
S
- Template:S-aft/doc
- Template:S-aft/filter/doc
- Template:S-bef/doc
- Template:S-bef/filter/doc
- Template:S-end/doc
- Template:S-start/doc
- Template:S-ttl/doc
- Template:Script/doc
- Template:SDcat/doc
- Template:Short description/doc
- Template:Show/doc
- Template:Side box/doc
- Template:Sister project/doc
- Template:Soft redirect/doc
- Template:Start date and age/doc
- Template:Start date/doc
- Template:String-handling templates/doc
- Template:Succession box/doc