Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Usage  





2 TOC levels versus wikitext header levels  





3 Conflicts  





4 TemplateData  





5 See also  














Template:TOC limit






Afrikaans
Anarâškielâ
Аԥсшәа
العربية
Արեւմտահայերէն

Avañe'
Azərbaycanca
تۆرکجه
Basa Bali

Banjar

Български
Boarisch
Bosanski
Català
Cebuano
Čeština
Cymraeg
Dansk
Deutsch
Eesti
Ελληνικά
Español
Esperanto
Euskara
فارسی
Føroyskt
Français
Galego


Հայերեն
ि
Ilokano
Bahasa Indonesia
Íslenska
Italiano
עברית
Jawa


Kreyòl ayisyen
Kurdî
Ladin
Ladino

Latviešu
Magyar
ि
Македонски

Malti
Bahasa Melayu
Minangkabau
Мокшень

Nederlands

 

Нохчийн
Norsk bokmål
Norsk nynorsk
ି
Oʻzbekcha / ўзбекча

ि

Português
Română
Русский
Scots

Simple English
سنڌي
Slovenčina
Slovenščina
کوردی
Српски / srpski
Srpskohrvatski / српскохрватски
Suomi
Svenska
 


Тоҷикӣ
Türkçe
Українська
Tiếng Vit


 

Edit links
 









Template
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




In other projects  



Wikimedia Commons
MediaWiki
Meta-Wiki
Wikidata
Wikifunctions
Wikiquote
Wikisource
Wikiversity
Wiktionary
 
















Appearance
   

 





Permanently protected template

From Wikipedia, the free encyclopedia
 


This template inserts a Table of Contents that omits subheadings beyond a certain depth. The table obeys the same layout rules as the __TOC__ magic word. Omitted sections still have section edit links in the article body. The main use for this template is situations where you want section edit links for ease of editing but don't want a full table of contents. Before using this template, consider whether and why it would be helpful to readers and other editors.

Usage

{{TOC limit}}or{{TOC limit|3}}

The template defaults to including second- and third-level headings, e.g. those numbered "1" and "1.1" in the TOC. (Note: {{TOC limit|1}} does nothing: the first-level heading on a page is, by default, the page title.)

You can specify a different limit by adding a header level:

{{TOC limit|4}}

4 allows for fourth-level headings, e.g. "1.1.1", but omits any subheadings below that from the TOC.

The template works by hiding the lower levels with CSS. See Template:TOC limit/styles.css.

TOC levels versus wikitext header levels

The heading levels in the TOC normally correspond to the header levels in the wikitext, so a "== Level-2 header ==" will normally generate the first-level ("1") TOC headings, a "=== Level-3 header ===" will normally generate the second-level ("1.1") TOC headings, and so on. This correspondence does not hold if the page contains "= Level-1 headers =" or skips header levels. For example, wikitext like this:

== Level-2 heading (A) ==
=== Level-3 heading (B) ===
== Level-2 heading (C) ==
====== Level-6 heading (D) ======
= Level-1 heading (E) =
== Level-2 heading (F) ==
=== Level-3 heading (G) ===

will generate a TOC like this:

Contents

  • 1 Level-2 heading (A)
    • 1.1 Level-3 heading (B)
  • 2 Level-2 heading (C)
    • 2.1 Level-6 heading (D)
  • 3 Level-1 heading (E)
    • 3.1 Level-2 heading (F)
      • 3.1.1 Level-3 heading (G)

Using {{TOC limit}} on this page would not hide header D, because even though it is a level-6 heading it is shown at the second level in the TOC. And it would hide header G even though it is a level-3 heading just like header B, because header G is shown at the third level in the TOC while header B is shown at the second level.

Conflicts

This template does not interact well with the {{TOC right}}, {{TOC left}}, {{TOC center}} templates. To achieve the correct effect, use those with a limit parameter. For example, {{TOC right|limit=2}} has the effect that {{TOC right}} and {{TOC limit|2}} would have—if they worked together.

Due to the way the TOC is generated with MobileFrontend (mobile/tablet view), this template does not currently affect how the mobile TOC is displayed.

This template does not work with the Vector 2022 skin. See the bug report at T317818 for details.

TemplateData

Inserts a Table of Contents that omits subheadings beyond a certain depth.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Limit1 limit

Maximum header depth to be included in table of contents

Default
3
Numbersuggested

See also

{{TOC hidden}}


Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:TOC_limit&oldid=872451201"

Categories: 
Templates using TemplateStyles
Wikipedia table of contents templates
Hidden category: 
Wikipedia template-protected templates
 



This page was last edited on 7 December 2018, at 07:36 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki