Template talk:TOC limit

Steps to limit the TOC in your mediawiki

 * 1) Add the following code in the file yoursite/MediaWiki:Common.css

/* Allow limiting of which header levels are shown in a TOC; , for instance, will limit to  showing ==headings== and ===headings=== but no further (as long as there are no =headings= on the page, which  there shouldn't be according to the MoS). */ .toclimit-2 .toclevel-1 ul, .toclimit-3 .toclevel-2 ul, .toclimit-4 .toclevel-3 ul, .toclimit-5 .toclevel-4 ul, .toclimit-6 .toclevel-5 ul, .toclimit-7 .toclevel-6 ul { display: none; }


 * 1) Create the page Template:TOClimit and paste the following code in it


 * 1) Paste the following code in your page in order to display the TOC with some limitations

Add a default
editprotected

Can we have a default value, so that  with no parameter limits the TOC to three levels?

class="toclimit-"

becomes

class="toclimit-"

Chris Cunningham (not at work) - talk 16:13, 3 October 2008 (UTC)
 * [[Image:Yes check.svg|20px]] Done. Cheers. --MZMcBride (talk) 18:06, 3 October 2008 (UTC)


 * The default value doesn't work currently; the if clause would need to be removed leaving:
 * 
 * Currently if no parameter is used the parser doesn't even get to the default value – Ikara talk → 04:16, 10 December 2008 (UTC)
 * ✅ -- lucasbfr  talk 10:04, 10 December 2008 (UTC)

Classic "can't get the template to work" user

 * Probably get this constantly, but I added it into List of recurring TUGS characters to only show ==this size== of headings, but it didn't work. Have i added it wrongly? --SteelersFanUK06  ReplyOnMine!   18:08, 5 January 2009 (UTC)
 * I have the same problem, can't anyone explain how to use this, and what to put where? Elev77 (talk) 19:55, 24 January 2009 (UTC)

Limit Toggle
Would it be possible to add a toggle to the TOC itself that turns the limit off? (Or is there another TOC template that does both?) I use the TOC primarily to see the organization of an article I am editing, especially a longer one, at a glance. A set limit prevents that, but a toggle to show the full TOC would be a nice option. Thanks. - BillCJ (talk) 10:05, 11 March 2009 (UTC)


 * It shouldn't be that different for anyone who knows a bit of JavaScript (it's just a case of swapping the class on the div), but I'm not that person. If there's no response here, you might want to try pinging WP:VPT. Chris Cunningham (not at work) - talk 10:20, 11 March 2009 (UTC)

OK, thanks. - BillCJ (talk) 10:29, 11 March 2009 (UTC)
 * If you mean a parameter sure that's easy. But if you mean something you can click on .. dunno. Maybe be better to override the class tag in your .css ?  Rich Farmbrough, 15:48 13 April 2009 (UTC).


 * Yes, I'm asking about something any user can click on, like the "Hide" toggle in the TOCs now. I think it would be useful for any editor to be able to see the whole TOC when the want too. Personally, I'd be interested in knowing how to override the class tag in my .css in the short term. Can you tell my how to do that? Thanks. - BillCJ (talk) 00:47, 14 April 2009 (UTC)


 * I would like to see that too. Without it, this template can be confusing. --Chealer (talk) 18:23, 4 May 2012 (UTC)

Is this template overused?
I spot checked a few random transclusions of this template, and IMO in the majority of cases the article would be better without this template. But I'm not about to embark on any quixotic attempt to mass-remove the template, I just created User:Anomie/untoclimit.css so I can see what is being hidden. Anomie⚔ 02:06, 1 June 2009 (UTC)


 * IMO it isn't used often enough - I'd far rather it were used instead of TOCright and such wherever possible. Chris Cunningham (not at work) - talk 09:54, 1 June 2009 (UTC)

What am I doing wrong?
I am trying the template on a scratch page ( User:Georgewilliamherbert/scratch1 ) and it is just not working.

I created a bunch of level 6 subsections, and with TOClimit either with the default or an explicit level 3 (or 2, or 4 or 5) they all show up in the TOC anyways.

I'm doing this as an experiment into a talk / noticeboard page UI improvement but it's just not being cooperative now.

Is it disabled in user space or something like that?

Did I miss something obvious?

Thanks for any help. Georgewilliamherbert (talk) 04:48, 4 September 2009 (UTC)
 * This template counts the depth of the list in the TOC, not the level of the headers. A level-2 followed by a level-6 (with no 3-5 in between) ends up as only two deep in the TOC, otherwise the TOC would end up looking something like this:
 * 6 Level-2 header
 * 6.0.0.0.1 Level-6 header
 * Anomie⚔ 11:55, 4 September 2009 (UTC)
 * Ack. Darn it.  Now I need to look at the actual template source and see what I can do...   Thanks.  Georgewilliamherbert (talk) 02:15, 5 September 2009 (UTC)
 * Hmm. The various mediawiki help page and manuals seem to indicate I should be able to do what I was hoping to.  This is frustrating.  Unfortunately the actual php source is just confusing me, I have not looked at the magic words handling much and it's not making much sense at the moment.  Off to the mailing list...  Georgewilliamherbert (talk) 02:54, 5 September 2009 (UTC)
 * Yeah, definitely misleading as it's written now. Any chance this can be changed so it'll deal with absolute section depth (the header level) rather than relative (the list depth), or that a new knock-off template can be made? Or add a "depth = {relative OR absolute}" parameter? I'd offer to help but I know no php — eitch 06:56, 28 December 2009 (UTC)

I'm having an issue with the limit number, I set it to 1 and get all 5 test levels in TOC, setting it to 2 only shows 1 level, setting it to 3 shows two levels, etc. Does it have to do with  ?

Is this Wikipedia-only? How might I set it up in my own, locally installed MediaWiki installation?
This feature would make a lot of stuff in our local MediaWiki much clearer, but it does not appear to work.

After adding TOClimit to the top of my article's code, it showed up as "Template: TOClimit" in red. So I clicked on it and pasted in what I found in the source code for this, but that didn't work either.

Advice on making this template work for a clean Mediawiki install?

Douglas, VT, 09/15/09 —Preceding unsigned comment added by 173.9.119.118 (talk) 18:51, 15 September 2009 (UTC)
 * You also need to copy the corresponding rules from Mediawiki:Common.css:


 * Anomie⚔ 22:21, 15 September 2009 (UTC)

Thank you! In case someone as green as I am wonders where in your local WikiMedia installation these rules need to be added, they should be added to your default css. In my case that turned out to be skins/monobook/main.css -- just add it to the end of the file. Liontooth (talk) 03:12, 21 September 2009 (UTC)
 * Actually, you should just add them to your local installation's Mediawiki:Common.css. While editing the file mentioned will work (as long as anyone only uses monobook on your site), it may give you trouble when it's time to upgrade your installation. Anomie⚔ 11:18, 21 September 2009 (UTC)

I'm looking where to find the Template as well. Install instructions, anyone? Please? 134.253.26.12 (talk) 23:22, 17 November 2009 (UTC)

It would be great if this piece of info was present on the actual template page documentation for those wanting to copy this functionality for their own installation. 203.217.18.57 (talk) 00:07, 4 March 2010 (UTC)

Admin or higher needed to fix the documentation
editprotected

Admin assistance is required to change the documentation to accurately depict the role of the limit function.

It has been noted since late 2009 that this needs changing and still has not been done.

Presently it states that " allows ==== level 4 headers ==== but omits any subheadings below that from the TOC."

This is not true. It will limit it to a depth of 4 levels.

If the article has the parameter set to and editors use ==Level2==, ===Level3=== and =====Level5===== (omitting level4) the =====Level5===== will still show in the TOC.

Chaosdruid (talk) 04:00, 20 February 2011 (UTC)
 * Admin assistance is not necessary. I've made an attempt at clarifying the documentation; you can improve it yourself by editing Template:TOC limit/doc. Anomie⚔ 07:09, 20 February 2011 (UTC)
 * That seems fine to me, thank you for doing it Chaosdruid (talk) 13:11, 20 February 2011 (UTC)

Odd issue
I'm having an issue that appears to be related to an infobox. I'm using TOC limit on Gardiner Expressway, but its not showing up where it used to not long ago. It seems to be getting pushed down by the infobox, even though it's on the opposite side of the page as the infobox. Any insight? -  ʄɭoʏɗiaɲ  τ ¢  20:12, 10 April 2011 (UTC)
 * Seems to me like an abuse of this template, really. Why do the subsections exist if they aren't going to be shown in the TOC? Anyway, the problem is due to CSS float rules: since the TOC's float appears in the HTML output after the float for File:Gardiner Expressway Downtown Toronto.jpg, the top of the TOC's float may not appear above the top of the image's float. It's the same thing that used to lead to WP:BUNCH problems with edit links. Anomie⚔ 23:40, 10 April 2011 (UTC)
 * Cool; thanks! My reasoning is to keep things clean when the subheaders are long in length or number -  ʄɭoʏɗiaɲ  τ ¢  00:01, 11 April 2011 (UTC)

TOC Limit on sister-wikis?

 * I am trying to use this on, but I'm hitting errors left and right... Please advise.  --jcarroll (talk) 12:14, 11 October 2011 (UTC)

Why no TOC on Talk page
The TOC is not showing on the Talk page of various articles I am coming across. How can this be corrected? I have checked for the "magic word" (_NOTOC_) in them and it doesn't appear to be there and yet no TOC. Suggestions? LookingGlass (talk) 13:34, 24 January 2013 (UTC)

Conflict with CompactTOC??
Something weird has happened at International recognition of Kosovo. Below section 3.2.1, there are a number of alphabetically-titled subsections, headed with CompactTOC template. The whole article has a template that should exclude all of these alphabetical sections from the main TOC. This used to work fine... but now they're back, and the depth of the subheadings has gone a bit weird. I can't figure out why - I can only assume that there is now some conflict between Toc limit and CompactTOC. Can anyone help? Thanks, Bazonka (talk) 14:42, 21 July 2013 (UTC)

Broken?
Doesn't seem to work over here. Broken? — Preceding unsigned comment added by Johnywhy (talk • contribs) 02:52, 21 June 2018 (UTC)

Doesn't apply to Vector（2022）
It works at the old Vector but if I change the appearance into Vector(2022), the level 4 headings still shownd. Can we get an update? Ojvolleyball (talk) 20:02, 18 October 2022 (UTC)
 * I wonder if it would be possible for someone to tweak Template:TOC limit/sandbox/styles.css to force specific, or all, TOC levels to display. When I use the code that is in there in my personal common.css file, the TOC is shown as expanded in Vector 2022. I haven't been able to make it work with this template's sandbox though. – Jonesey95 (talk) 18:04, 27 February 2023 (UTC)
 * See T317818 -- Great Brightstar (talk) 15:46, 14 May 2023 (UTC)

Who made first parliament in world?
the lord basavanna made first parliament in world in 12 th century

Name of parliament was :-Anubhav Mandapam Deepakchunke (talk) 15:24, 2 April 2023 (UTC)