Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Section
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== {{anchor|TOC}}{{anchor|Table of contents}}Table of contents (TOC) == {{Shortcut|H:TOC|WP:TOC}} {{redirect|Wikipedia:Table of contents|Wikipedia's contents|Wikipedia:Contents}} [[Image:Wikipedia TOC, Vector 2022.png|thumb|An example Table of Contents as viewed in the default Vector 2022 skin]] {{update section|reason=TOC is now in the [[hamburger menu]]}} === Hiding the TOC === For each page with at least four headings, a '''table of contents (TOC)''' is automatically generated from the section headings unless the [[Help:Magic words|magic word]] '''<code><nowiki>__NOTOC__</nowiki></code>''' (with two underscores on either side of the word) is added to the article's [[Help:Wiki markup|wikitext]]. <code><nowiki>__NOTOC__</nowiki></code> should ''not'' be used in articles that (a) have fewer than four headings or (b) do not fit on one screen.<ref>Small-screen mobile platforms use an alternative navigation scheme, which is not affected by <code><nowiki>__NOTOC__</nowiki></code>. For rendering of articles on a PC, whether an article fits on one screen is dependent on screen size and display settings.</ref> Using certain templates, such as {{tl|Compact ToC}}, will ''replace'' the regular table of contents functionality. === Positioning the TOC === When either <code><nowiki>__FORCETOC__</nowiki></code> or <code><nowiki>__TOC__</nowiki></code> (with two underscores on either side of the word) is placed in the wikitext, a TOC is generated even if the page has fewer than four headings. Using <code><nowiki>__FORCETOC__</nowiki></code> places the TOC immediately before the first section heading. Using <code><nowiki>__TOC__</nowiki></code> places the TOC at the same position as this code. Most articles have introductory text before the TOC, known as the "lead section". Although usually a section heading should immediately follow the TOC, using <code><nowiki>__TOC__</nowiki></code> can prevent you from being forced to insert a meaningless heading just to position the TOC correctly (i.e. not too low). However, if there is any text at all between the TOC and the first heading, this will cause problems with accessibility. ==== Floating the TOC ==== The TOC can, in some instances, be [[Cascading Style Sheets#Float and clear|floated]] either right or left using {{tlx|TOC right}} or {{tlx|TOC left}} when it is beneficial to the layout of the article, or when the default TOC gets in the way of other elements. Before changing the default TOC to a floated TOC, consider the following guidelines: # If floating the TOC, it should be placed at the end of the lead section of the text, before the first section heading. Users of [[screen reader]]s do not expect any text between the TOC and the first heading, and having no text above the TOC is confusing. ''See the last line in the information about [[Wikipedia:Manual of Style/Lead section#Elements|elements of the lead section]].'' # When floating a TOC, check whether the page layout will be harmed if the TOC is hidden by the user. # Long lists may create very long TOCs. The TOC should not be longer than necessary, whether it is floated or not. {{tlx|TOC limit}} can be used to reduce the length of the TOC by hiding nested subsections, rather than a floating TOC. # The default TOC is placed before the first headline, but after any introductory text. If the introductory summary is long enough that a typical user has to scroll down to see the top of the TOC, you may float the TOC, so it appears closer to the top of the article. However, the floating TOC should in most cases follow at least the first paragraph of article text. # Floating a wide TOC will produce a narrow column of readable text for users with low resolutions. If the TOC's width exceeds 30% of the user's visible screen (about twice the size of the Wikipedia navigation bar to the left), then it is not suitable for floating. (Percentages assume a typical user setup.) If text is trapped between a floating TOC and an image, floating can be cancelled at a certain text point, see [[Wikipedia:Picture tutorial#Forcing a break|Forcing a break]]. # If the TOC is placed in the general vicinity of other floated images or boxes, it can be floated as long as the flowing text column does not become narrower than 30% of the average user's visible screen width. # A left-floated TOC may affect bulleted or numbered lists. [[Template:TOC right]] was proposed for deletion in early July 2005, but there was no consensus on the matter. The archive of the discussion and voting regarding this may be seen at [[Wikipedia:Templates for deletion/TOCright]]. The Manual of Style discussion can be found [[Wikipedia talk:Manual of Style/Archive 17|here]]. === Limiting the TOC's page width === An extenuating circumstance may require the width of a TOC to be adjusted as a percentage of a page. For example: {{tlx|TOC left|2=width=30%}} === Limiting the TOC's content depth === {{Shortcut|H:LIMITTOC}} By default, the TOC includes all the headings in the page, whatever their level. When an article or project page has a very large number of subsections, it may be appropriate to hide lower-level subsections from the TOC. You can specify a limit for the lowest-level section that should be displayed using {{tlx|TOC limit|<var>n</var>}}, where <code><var>n</var></code> is the number of <code>=</code> signs that are used on each side of the lowest-level section header that should be displayed (e.g. <code>3</code> to show all headings down to <code><nowiki>===sub-sections===</nowiki></code> but hide <code><nowiki>====sub-sub-sections====</nowiki></code> and all headings below that). The <code>limit=<var>n</var></code> parameter can also be given to {{tlnull|TOC left}} or {{tlnull|TOC right}} the same way. === Replacing the default TOC === {{shortcut|WP:REPLACETOC}} The auto-generated TOC is not maximally appropriate or useful in all article types, such as long [[WP:SAL|list articles]] and [[WP:MOSGLOSS|glossaries]], so there are [[:Category:Wikipedia table of contents templates|numerous replacement templates]]. To use one, place the replacement TOC template, such as {{tlx|Compact TOC}} (which can be customized for many list styles) where needed. You are encouraged to put <code><nowiki>__NOTOC__</nowiki></code> at the top of the article to ensure correct functionality, but in many cases the regular TOC will be suppressed just by the addition of the replacement TOC template. === Horizontal TOC === The template {{tl|Horizontal TOC}} lays out the TOC in a horizontal list rather than a vertical one. It can be practical in a TOC with many brief entries. The ability to display a long TOC without scrolling makes it suited for tables where the rows contain section headings. :''Example: [[Legality of cannabis by country]] β uses a concise but functional AβZ horizontal TOC.'' :''Example: {{oldid2|672148569|Legality of cannabis by U.S. jurisdiction}} β uses two TOCs; a short, vertical one, and a long, horizontal one.''
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)