Help:Table of contents

From Saintapedia
Revision as of 23:10, 7 October 2024 by Tom (talk | contribs) (Text replacement - "Category:HelpCategory:Help under review" to "Category:Help")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Shortcut:
H:TOC
File:Table of Contents.png
Screenshot of an article's Table of Contents
Help
Getting Started
Picking a UsernameTeach Yourself Wiki
Policies and guidelines
Saintapedia:Copyrights
The Saintapedia Interface
Left NavigationToolbox Discussion/Talk PageEdit & HistorySearchLog in & Create an Account
Editing Saintapedia
Creating a new pageCreating your user page • Editors (Visual/Enhanced) • Editing toolbarCheat SheetMagic wordsTable of Contents
Links
Internal linkExternal linkInterWiki linkCategory link Reference links
Images and Media
File Upload Guidelines for SaintapediaHow to upload new versions of filesImage mapNaming Conventions for FilesUpload documents
Tracking Changes
Recent Edits on SaintapediaArticle historyReverting to an earlier versionWatchlistHow to add a page to your watchlist
Asking Questions
Using talk pagesHelp:CommentStreams
Resources and Lists
Categories InfoboxHelp:Templates
Account settings and maintenance
Change your preferences Confirm your email address
Technical information
The MediaWiki softwareParser functions
All topics
view · talk · edit

A table of contents (TOC), usually headed simply Contents, is a linked list of section headings on a page before the main contents of a page. For each page with four or more section headings, a table of contents is automatically generated and updated after each change to the headings.

By default

  • it appears below the lead section, however it can be manually positioned at another location on the page
  • it includes all section heading levels, however this can be changed as well by limiting the depth of the table of contents

The creation of a table of contents is prevented if:

Determining which editor to use

Positioning the TOC

When either __FORCETOC__ or __TOC__ (with two underscores on either side of the word) is placed in the wikitext, a TOC is added even if the page has fewer than four headings.

With __FORCETOC__, the TOC is placed before the first section heading. With __TOC__, it is placed at the same position where this code is placed. There may be some introductory text before the TOC, known as the "lead". Although usually a heading after the TOC is preferable, __TOC__ can be used to avoid being forced to insert a meaningless heading just to position the TOC correctly, i.e., not too low.

Floating the TOC

The TOC can, in some instances, be floated/aligned either right or left using {{TOC right}} or {{TOC left}}templates 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:

  1. If an article will be adversely affected by the change, don't float the TOC.
  2. If floating the TOC, it should be placed after the lead section of the wiki markup for consistency. Users of screen readers 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 elements of the lead sectionWikipedia Logo.png.
  3. When floating a TOC, check whether the page layout will be harmed if the TOC is hidden by the user.
  4. Long lists may create very long TOCs. The TOC should not be longer than necessary, whether it is floated or not. {{TOC limit}} can be used to reduce the length of the TOC by hiding nested subsections, rather than a floating TOC.
  5. The default TOC is placed before the first headline, but after any introductory text (unless changed by the page's editors). 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.
  6. 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 Forcing a breakWikipedia Logo.png.
  7. 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.
  8. A left-floated TOC may affect bulleted or numbered lists.

Limiting the depth of the TOC

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 {{TOC limit|limit=n}}, where n is the number of lowest-level section header that should be displayed.

It can also be limited with {{TOC right}} - {{TOC right|limit=2}}.

Linking to the TOC

The TOC is automatically generated with HTML id="toc". You can make a link to it with [[#toc]]:

  • Same page:
    • wikicode: [[#toc|Contents]]
    • link: Contents
  • Different page:
    • wikicode: [[Help:Wiki markup#toc|Contents]]
    • link: Contents

Replacing the default TOC

The auto-generated TOC is not maximally appropriate or useful in all article types, such as long list articles and glossaries, so there are numerous replacement templatesWikipedia Logo.png. To use one, place the alternative TOC template, such as {{CompactTOC8}} (which can be customized for many list styles) or {{TOC scroll}}, where needed.

Scrolling table of contents

Please see Template:TOC scroll. This is especially useful for a long article's table of contents.