Template talk:Automatic category TOC

Thresholds
IMHO, 200 rather than 100 PAGESINCATEGORY should be the threshold for displaying a table of contents, because the TOC is only needed when the contents overflow to more than one page. – Fayenatic  L ondon 11:41, 1 October 2019 (UTC)
 * @Fayenatic, that was my initial thought, but then I realised that a TOC could still be handy when the listing extends below the fold.
 * See for example Category:1923 establishments in Japan, with 139 items listed: the TOC takes you directly to the relevant section, which some readers may find handier than scrolling. Since the std TOC is not bulky, there is little cost in adding it, so it seemed to me to be better to have the TOC for the benefit of those readers who do want it.
 * Ideally, of course, we'd have real usability testing to learn what readers actually do, but without that all we can do is make informed guesses. What do you think of my informed guess? --  Brown HairedGirl  (talk) • (contribs) 11:53, 1 October 2019 (UTC)
 * OK, that makes sense. Can we at least have a clear space above it? What drove me here was the appearance of e.g. Category:Houses completed in 1894 which I find cluttered, since the TOC is currently contiguous with navseasoncats. – Fayenatic  L ondon 13:24, 1 October 2019 (UTC)
 * Hi @Fayenatic, good point. That's something I had noticed a few times before, but hadn't found a quick solution to ... so thanks for the poke.
 * My various tests of adding blank lines didn't seem to help, so in this edit I added a 1em top-margin to Template:Category TOC. I think that has done it. How does it look to you? --  Brown HairedGirl  (talk) • (contribs) 13:39, 1 October 2019 (UTC)
 * And I did the same to Template:Large category TOC. -- Brown HairedGirl  (talk) • (contribs) 13:42, 1 October 2019 (UTC)
 * Yes, I'm happy with the result now, thanks again! – Fayenatic  L ondon 15:53, 1 October 2019 (UTC)

Parameters
Nice work @BrownHairedGirl, unnecessary TOCs are a bit of a bugbear of mine. Any chance that this could be changed to pass through parameters such as  to Category TOC ??? TIA Le Deluge (talk) 00:18, 25 February 2020 (UTC)
 * Sorry for a slow reply, @Le Deluge.  I only just spotted your comment.
 * This had occurred to a few times, but your comment persuaded me to see if I could make it work. I have made a trial version at CatAutoTOC/core/sandbox, which takes all the same parameters as Category TOC.  Undocumented for now, but the parameters are all exactly as listed at Template:Category_TOC.
 * It really needs some intensive destructive testing. Would you be willing to see if you can break it? --  Brown HairedGirl  (talk) • (contribs) 04:03, 16 March 2020 (UTC)
 * Ach, sorry for not pinging you properly, I could have sworn simple @ing worked. I can do a bit of testing, at the moment things are a bit busy but they may get much quieter for a few months... I'm sorry I'd missed all your Wikidrama, I hope you find a way to continue (under another name?), and thanks for the stuff you've been doing on TV cats, I've some ideas for some more clever cat/title templates if I do get some time in...Le Deluge (talk) 21:34, 16 March 2020 (UTC)
 * Many thanks, @Le Deluge. The wonderful support I received has persuaded me to continue for a bit longer..
 * No rush on this testing, so whenever you have time and inclination. Maybe I'll find space to test it myself.
 * I think that for cat/title templates we need some smarter Lua-based meta templates. It will e good to talk that through with you when have the space. --  Brown HairedGirl  (talk) • (contribs)
 * @Le Deluge, I have now implemented the parameter pass though (in these two edits), and documented it at Template:CatAutoTOC/doc. -- Brown HairedGirl  (talk) • (contribs) 17:26, 14 April 2020 (UTC)

Template at a category that HAS only one letter
I've seen these TOCs at categories--sometimes very large--that have only one letter. This typically happens at a stub category for a large genus of living creatures (i.e., the first of the two parts of the "scientific name). All the articles begin with the genus name, thus with the same letter. On the non-stub category page, there's a way to break that up; you provide a sortkey for the species name (the second part of the "scientific name"), and the list is broken up alphabetically that way.  I have done this with literally thousands of individual articles in long category pages (I'm in the middle of a 600 item category now).  But as far as I can tell, there's no way to do that on the stub page.  So if all the articles in a stub category begin with the same letter, the TOC is absolutely useless. Uporządnicki (talk) 01:22, 3 May 2020 (UTC)
 * @AzseicsoK (aka Uporządnicki): as I just noted in my reply to your post at WT:WikiProject_Stub_sorting, there were bound to be a few edge cases like this where the TOC adds little benefit ... but not, as PamDnoted there, no benefit.
 * I remain of the view that the existence of edge cases like this is far outweighed by the benefits of an automatic TOC on tens of thousands of other pages. -- Brown HairedGirl  (talk) • (contribs) 09:29, 4 May 2020 (UTC)

Layout tweak?
Howdy folks! I have but one suggestion to make regarding the CatAutoTOC and related items: would it mess things up too much to add a line break and clear="all" at the end of the template code? On category pages where there are already banners, they're getting squashed to one side by the auto TOC. As far as I can tell, there seems to be no way for an ordinary editor (like me) to change the placement of the TOC in order to improve the readability of the layout (say, placing it below the other banners). This is merely an aesthetic request, and I don't want to screw up the functionality of the template, but I appreciate any consideration you can give it. Cheers, Her Pegship (I'm listening) 14:48, 4 May 2020 (UTC)
 * @Her Pegship, I generally dislike "clear all" in elements of a category header, because lots of header content is best displayed when floated either left or right, and clearall messes that up, wasting vertical space.
 * In any case, category TOCs are most useful when placed as the last item in the category header, so when I add it I place it at the bottom of the category page's wikicode. One editor recently went on a AWB spree, adding CatAutoTOC the top of thousands of pages (see User talk:Hmains permalink ).
 * Please can you link to some of the pages which you think are problematic? -- Brown HairedGirl  (talk) • (contribs) 21:48, 9 May 2020 (UTC)
 * I noticed it first on, and when I went to adjust the layout I couldn't find the code for the TOC in order to place it at the bottom. Under the edit box I see that there are two hidden categories: Category:CatAutoTOC generates standard Category TOC and Category:Template Category TOC via CatAutoTOC on category with 601–900 pages. So I guess I'm talking about TOCs that are not added by humans (in which case I'd just rearrange the template codes), and whose position on the page is not defined. As I said, it's simply an aesthetic issue that I can live with, just thought I'd mention it. However, if you have any suggestions on how to rearrange other banners around the TOC, I would like to have them handy. Cheers, Her Pegship (I'm listening) 22:16, 9 May 2020 (UTC)

Thanks, Your Pegship.

The issue here is that Stub category includes CatAutoTOC, since I added it in February. This saves adding it manually to the 15,000+ category pages which use Stub category.

In the vast majority of cases, there is no problem, because there isn't any text on the category page below Stub category. But you're right; where that text exists (as on ), it isn't being handled well. This sin't directly an issue with CatAutoTOC, because CatAutoTOC doesn't itself generate any output. It just decides whether to invoke Category TOC or Large category TOC, and they generate the output.

In the case of, it is Category TOC which is being used and causing the display issues.

I can see two possible solutions:
 * 1) put a    above the header text.  That will force the text below the TOC.  A bit of a waste of whitespace, but probably better than having the text rubbing against the edge of the box.
 * 2) The ideal solution would be to fix the CSS in Category TOC, so that it leaves a margin to the right.  I tried two different ways of doing this, but withoiut success. The CSS classes in use have defeated me before, so I gave up.

Hope that helps a bit. -- Brown HairedGirl  (talk) • (contribs) 14:10, 10 May 2020 (UTC)
 * Thanks for the advice! I'll try that on the stub cats I come across. I appreciate your efforts. Cheers, Her Pegship (I'm listening) 03:14, 11 May 2020 (UTC)

Template removed from ~5,000 pages
This template was removed from 5,000+ categories on 19 June 2020 (see here, in increments of 1,000), and the consensus for adding it was questioned. The broader question about consensus aside, there is no reason for this template to be removed from 5,000+ categories when it is transcluded on 460,000+ others. Is there a relatively quick way to add them back?

On a related note, while the use of an automatic TOC makes sense to me, I do wonder if there is some way to implement it for the whole namespace as opposed to individually transcluding a template on each category page... -- Black Falcon (talk) 05:57, 21 July 2020 (UTC)
 * Pinging User:BrownHairedGirl, User:Fayenatic london, User:Le Deluge, and User:Pegship, in hopes of inviting attention to this item. -- Black Falcon (talk) 19:25, 26 July 2020 (UTC)
 * I'm pretty ambivalent about the use and procedure regarding the auto TOCs (my only concern was mentioned above as an aesthetic query). Has anyone discussed this with, who seems to have done the recent removals? Her Pegship (I'm listening) 22:11, 26 July 2020 (UTC)
 * If there is consensus to do so, and there is reason to believe user:Justlettersandnumbers would not revert it again, I could reinstate the template. Mass rollback would currently work in 99% of cases on that list of contribs, and I don't mind manually reinstating the remainder.
 * But is there consensus for using this template on those categories? That page of 1,000 are maintenance cats and Wikipedians. See User_talk:50.26.172.216, and then User_talk:Justlettersandnumbers where Justlettersandnumbers seemed to be objecting only to the anon being unresponsive to requests, and not objecting to the TOC per se. I think only user:Johnbod was sustaining an objection in particular cases, and his objection about small categories overlooks that the Auto TOC produces nothing on a small category.
 * As for the comment about automating TOC for the category namespace, that sounds sensible, but I can't comment on viability or timescale for that. – Fayenatic  L ondon 22:31, 26 July 2020 (UTC)
 * Yes, I am still hostile to these. Once again I invoke Category:U-boats commissioned in 1916, as it used to be before I removed the stupid thing! Is "the Auto TOC produces nothing on a small category" true? Examples please. Johnbod (talk) 23:50, 26 July 2020 (UTC)
 * @Johnbod, it's best not to use words like "stupid" in discussions like this. Your example of a category where nearly all the entries are sorted on the same letter is a very rare outlier.  It's not unique, but such categories are a tiny fraction of the ~1.9 million categories. Even if there are 1,000 categories, that's 0.05% of the total. Dismissing a tool because it helps in only 99.95% of cases is ... well, your word.
 * As to your question about whether "the Auto TOC produces nothing on a small category", yes of course it does what it says on the tin. The behaviour is described in the first lines of the template documentation.
 * There's no magic and no effort involved in verifying that: just look at Template:CatAutoTOC, where the stats show hundreds of thousands of categories where it produces nothing. See e.g. Category:1st-century Indian people ... or any of the categories tracked in Category:CatAutoTOC generates no TOC.
 * You could also have tested this yourself simply by adding the template to any small category and either saving or previewing.
 * So I am very surprised by Johnbod's hostility. I am used to Johnbod being one of those editors who brings light to a discussion, but here? How hard is it to read the documentation and/or do a quick test before adopting a hostile stance? -- Brown HairedGirl  (talk) • (contribs) 01:44, 27 July 2020 (UTC)


 * @Black Falcon, I agree that it would be much better to have this functionality built into the MediaWiki software, so that it was applied automatically for the whole namespace. I created this template very much as a workaround to a flaw in the software, and I'd be delighted for it to become redundant.
 * But then the category software is appallingly crude in many respects. I have a long list of desirable improvements to it, which I have never written up, because there seems to be zero chance of them being implemented. Categories aren't widely used, so whenever the WMF holds one of its polls for most-wanted software tweaks, category stuff rarely gets into the action list.
 * Anyway, back to the removal of mass removal of CatAutoTOC by . The first question for me is why on earth anyone would want to remove it?  How does that help anyone?
 * I notice that these edits were done using WP:Rollback. Having looked at WP:ROLLBACKUSE, this doesn't seem to me be a justifibale use of rollback: I don't see how any of the numbered criteria apply.  That page says   This looks to me like misuse. If Justlettersandnumbers thought that using CatAutoTOC is a bad idea, they should have started a discussion about it.  I hope that they will now join this discussion.
 * Re-adding CatAutoTOC would be a very simple AWB job. I have made a list of the 5,084 pages reverted, and it would be easy to use AWB to re-add them.  But the best thing would be if Justlettersandnumbers simply rolled back their reverts. --  Brown HairedGirl  (talk) • (contribs) 01:19, 27 July 2020 (UTC)
 * The above restrictions apply to standard rollback, using the generic edit summary. If a tool or manual method is used to add an appropriate explanatory edit summary (as described in the Additional tools section below), then rollback may be freely used as with any other method of reverting. -> not a misuse of rollback, since Justlettersandnumbers provided an edit summary. * Pppery * it has begun... 02:27, 27 July 2020 (UTC)
 * I reverted some edits of that IP because it disruptively continued to make them after it had repeatedly been asked to stop – prior discussion here, as obviously knows, since she participated in it. At about the same time, another admin blocked the address, and with hindsight that would probably have been the better option. I've no objection to people or processes re-adding it to those cats if there's firm consensus to do so. Justlettersandnumbers (talk) 08:39, 27 July 2020 (UTC)
 * , you didn't revert some edits. 5,082 is not "some"; it's a hell of a lot.  It's more than 6% of the total edits you have made to en.wp in the last ten years.
 * Nor is it true that I participated in a discussion about this. I left a note there on 17 April, when I didn't ask the IP to stop -- I just suggested that it was a better use of their time to leave this to AWB. The later posts in the same section were several weeks later.  They didn't ping me, so I was unaware of them until now. One of the objectors was Uporządnicki, who mostly withdrew their objection.
 * And those who did object were mostly objecting to the addition on pages of less than 100 articles ... but your rollback seems to have been indiscriminate. I don't see any sign of you having been selective in your use of rollback.  Nor do I see any consensus anywhere that the additions were counterproductive; there was just some editors saying that they were not needed.
 * Before mass removal, there should have been some centralised discussion (e.g. here on the template's talk page).


 * But the crucial point is that over 85% of the pages to which CatAutoTOC has been added have less than 100 pages. That info was available to you at the time, simply by looking at Template:CatAutoTOC, where the live stats are displayed.  Given that the alleged problem was in fact the normal use case, it's absurd to claim that a few ill-informed objections on the talk page of an IP amount to a consensus about the use of the template.
 * I have just checked a sample of your reverts. The last 500 categories of your 5,082 reverts are listed at Template talk:CatAutoTOC/reverts, along with the PAGESINCATEGORY count.  Only 5 of those 500 categories have less than 100 pages ... so in precisely 99% of that sample of your reverts, the reverts didn't even meet the criteria of the objectors.  Also, 3 of those 5 categories are close enough to the threshold that the TOC will be needed even if there is only slight expansion:
 * Category:Wikipedian students —
 * Category:Requests for peer review —
 * Category:Use Irish English from May 2014 —
 * That situation of TOC being ready to display if needed is precisely what CatAutoTOC was designed to do -- but you removed it.
 * I don't doubt that your rollback was done in good faith, ... but it's very clear that it was a) done without adequate assessment, and b) that the reverts were overwhelmingly disruptove, because they didn't even meet the criteria of the objectors.
 * So ... please undo these reverts. -- Brown HairedGirl  (talk) • (contribs) 09:39, 27 July 2020 (UTC)
 * OK, that's sufficient consensus. I reverted the 1,000 linked above. – Fayenatic  L ondon 11:44, 27 July 2020 (UTC)
 * It seems that has already done that. Justlettersandnumbers (talk) 12:14, 27 July 2020 (UTC)
 * Many thanks, @Fayenatic. That helps ... but it still leaves another 4,082 reverts in place. Do you and want me to make another list of page counts, or will one of you revert without?
 * The pattern seems very clear to me, but if you want more data then I will produce it. -- Brown HairedGirl  (talk) • (contribs) 12:40, 27 July 2020 (UTC)
 * OK, I have reverted 4,964 pages, and think I checked them all. In case this affects your method of counting, a few had Navseasoncats reinstated rather than CatAutoTOC. – Fayenatic  L ondon 21:02, 27 July 2020 (UTC)
 * Many thanks, @Fayenatic. That's great work.  All resolved, I think. --  Brown HairedGirl  (talk) • (contribs) 22:42, 27 July 2020 (UTC)

Wrong
523 is wrong, 529 is right, can you fix it? https://en.m.wikipedia.org/wiki/Category:Gay_musicians King of Xavier (talk) 10:48, 17 August 2020 (UTC)
 * @King of Xavier, please explain what you mean. 523 what? 529 what? -- Brown HairedGirl  (talk) • (contribs) 21:58, 30 August 2020 (UTC)
 * Maybe the number of pages in that category? – Fayenatic  L ondon 23:38, 30 August 2020 (UTC)

Template-protected edit request on 14 October 2020
+ — Preceding unsigned comment added by 89.111.226.99 (talk) 05:25, 14 October 2020 (UTC)
 * Red question icon with gradient background.svg Not done: it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format and provide a reliable source if appropriate. JsfasdF252 (talk) 05:21, 11 January 2021 (UTC)

TOC gets mangled: rare glitch
In some rare circumstances, the TOC can be mangled and malformed.

I meant to document this when I found it a year ago, but it arose again with Category:Educational institutions established in the 15th century, so I summarised the issues at Template talk:Eiei-century (permalink)

The precise situation which causes trouble is when these two conditions both apply:

and
 * 1) the pages includes text below a Navseasoncats navbox
 * 1) that text is indented.

When those two conditions apply, HTML tidy produces a strange quirk of markup which breaks the CSS for the navigation TOC: the browsers try indenting the TOC box, and somehow fail screw up all the styling. The various en.wp stylesheets are so complex that I can't figure exactly what happens under the hood.

But the solution is simple: do not indent any text which appears under the Navseasoncats, 'cos the indent will break the category.

Hope this helps. -- Brown HairedGirl  (talk) • (contribs)
 * is still a problem? Can you link to a revision in which this exists?  ~ Tom.Reding (talk ⋅dgaf)  21:58, 7 April 2021 (UTC)
 * @Tom.Reding, not still a problem now fixed. No, can't link to a revision, 'cos the problem doesn't appear on the template page. --  Brown HairedGirl  (talk) • (contribs) 22:19, 7 April 2021 (UTC)
 * . Let there be indents.  ~ Tom.Reding (talk ⋅dgaf)  15:50, 8 April 2021 (UTC)

Template-protected edit request on 30 July 2022
Please increase the no TOC threshold from 100 to 200. New pages on categories are created every 200 entries, not every 100. Jalen Folf  (talk)  07:50, 30 July 2022 (UTC)
 * ❌ This is deliberate, see * Pppery * it has begun...  13:42, 30 July 2022 (UTC)

Requested move 28 April 2024

 * The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review after discussing it on the closer's talk page. No further edits should be made to this discussion.

The result of the move request was: moved. – robertsky (talk) 20:06, 6 May 2024 (UTC)

Template:CatAutoTOC → Template:Automatic category TOC – For consistency with the names of everything listed at Template:CatAutoTOC/doc, including Category TOC and Large category TOC. Additionally, per WP:TPN, template names should use standard English spacing.

A previous WP:BOLDMOVE by Mclay1 was reverted by BrownHairedGirl, so I am bringing this to a full RM. House Blaster  (talk · he/him) 18:25, 28 April 2024 (UTC)


 * Strong support per nom. There's no reason to use a name that is difficult to understand for new users. In particular, it's confusing to use "Cat" over "Category" in template names because cat is obviously its own word, and while I don't know what a cat template would do, a new user isn't necessary going to have any idea what it's supposed to mean. My move was reversed with the summary "The brief name is easier to use, and distinguishes this meta-template from the templates which do the actual work of generating a TOC." The brief name being "easier to use" (presumably meaning slightly quicker to type) is moot because it will continue to exist as a redirect. And this is not a meta-template in my understanding of the term, which is a template used in other templates – this template is used directly on category pages (how it functions internally is irrelevant to how it is used by users). MClay1 (talk) 23:57, 28 April 2024 (UTC)


 * Support. There is no need to create or name templates with short, unclear or confusing names. Gonnym (talk) 09:04, 30 April 2024 (UTC)

The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
 * Support per nom. SilverLocust 💬 22:50, 5 May 2024 (UTC)

Protected edit request on 9 May 2024
Please change  to   in both places it appears per the rename of Category:Templates using CatAutoTOC to Category:Templates using Automatic category TOC. Thanks! House Blaster  (talk · he/him) 12:00, 9 May 2024 (UTC)
 * HouseBlaster, could you please check that Special:Permalink/1223037015 contains the required changes? Diff with live template: Special:Diff/1222940524/1223037015. —⁠andrybak (talk) 13:58, 9 May 2024 (UTC)
 * yes; thank you :) House Blaster  (talk · he/him) 13:59, 9 May 2024 (UTC)
 * ✅ &mdash; Martin (MSGJ · talk) 21:24, 9 May 2024 (UTC)

Protected edit request on 9 May 2024 – Template:Automatic category TOC/core
Please sync with Template:Automatic category TOC/core/sandbox which updates categories following Template talk:Automatic category TOC. It also makes a couple of minor formatting changes to simplify code, namely, using  instead of. Thanks! House Blaster  (talk · he/him) 12:15, 9 May 2024 (UTC)
 * Note this request is for Automatic category TOC/core, not Automatic category TOC itself. House Blaster  (talk · he/him) 14:07, 9 May 2024 (UTC)
 * I'm not convinced your simplifications will work, because these parameters may be passed blank, so the output will not be the equivalent &mdash; Martin (MSGJ · talk) 21:28, 9 May 2024 (UTC)
 * I have dropped that part of the request; would you be able to sync to with the sandbox? Thanks, House Blaster  (talk · he/him) 22:13, 9 May 2024 (UTC)
 * ✅. You've got to watch those blank/undefined parameters because it's easy to make a mistake like that! &mdash; Martin (MSGJ · talk) 08:29, 10 May 2024 (UTC)
 * Martin, I assume you didn't intend to call Automatic category TOC/core/sandbox in the actual template? — Qwerfjkl  talk  09:04, 11 May 2024 (UTC)
 * Obviously not, sorry. Can you do an edit protected request because I'm on my phone now &mdash; Martin (MSGJ · talk) 18:38, 11 May 2024 (UTC)

Protected edit request on 11 May 2024
Please sync with Template:Automatic category TOC/sandbox, which calls Template:Automatic category TOC rather than Template:Automatic category TOC/sandbox. Thanks! House Blaster  (talk · he/him) 18:57, 11 May 2024 (UTC) House Blaster  (talk · he/him) 18:57, 11 May 2024 (UTC)
 * The request is missing "/core" in the names of the templates which are being called. The diff to apply: Special:Diff/1223095596/1223378324. Side note: the incorrect /core/sandbox got automatically protected by MusikBot II due to this issue. —⁠andrybak (talk) 19:15, 11 May 2024 (UTC)
 * ✅ * Pppery * it has begun... 05:07, 12 May 2024 (UTC)

Why is everything a comment?
Every single line here is a comment:   could be just.

Why is it so? I can't imagine what purpose that serves, and the code is diluted by the unnecessary comment blocks. -- Mikeblas (talk) 07:36, 28 June 2024 (UTC) Mikeblas (talk) 07:36, 28 June 2024 (UTC)
 * The comments are there for readability of the template code.  ~ Tom.Reding (talk ⋅dgaf)  10:44, 28 June 2024 (UTC)