Product Code Database
Example Keywords: ink -gloves $45-127
barcode-scavenger
   » » Help: Section
Tag Help 'Section'.
Tag

Help:Section
 (

Rank: 100%
Bluestar Bluestar Bluestar Bluestar Blackstar

A page can and should be divided into sections, using the section heading syntax. For each page with more than three section headings, a table of contents (TOC) is automatically generated. This page explains the syntax of these elements. For information about how to name sections or how to use sections to structure articles, please read the .


Creation and numbering of sections
Sections are created by creating their headings, as below.

     

Section

Subsection

Sub-subsection
Please do not use only one equals sign on a side (). This would cause a section heading to be as large as the page's name (title). The maximum number of equals signs is six.

Heading names of sections (including subsections) should be unique on a page. Using the same heading more than once on a page causes problems:

  • An to a section, in the form , will only link to the first section on the page with that name, which may not be the intended target of the link. See also .
  • When a section with a duplicate name is edited, the edit history and summary will be ambiguous as to which section was edited.
  • When saving the page after a section edit, the editor's browser may navigate to the wrong section.


Numbering
For registered users who use the preference setting , sections are numbered in the table of contents and at beginning of each section heading.


Sorting order
For the ordering of (appendix & footer) sections see: .


Table of contents (TOC)
For each page with more than three headings, a table of contents (TOC) is automatically generated from the section headings, unless:
  • (for a user) are set to turn it off
  • (for an article) the <nowiki></nowiki> (with two underscores on either side of the word) is added to the article


Positioning the TOC
When either <nowiki></nowiki> or <nowiki></nowiki> (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 <nowiki></nowiki>, the TOC is placed before the first section heading. With <nowiki></nowiki>, 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, <nowiki></nowiki> 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 either right or left using or 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 at the end of the lead section of the text, before the first section heading. Users of 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 .
  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. 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 .
  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.

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 . The Manual of Style discussion can be found .


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 , where <var>n<var> is the number of = signs that are used on each side of the lowest-level section header that should be displayed (e.g. 3 to show <nowiki></nowiki> but hide <nowiki></nowiki>). The limit=<var>n</var> parameter can also be given to or the same way.


Linking to the TOC
The TOC is automatically generated with HTML id="toc". You can make a link to it with <nowiki></nowiki>:
  • Same page:
    • wikicode: <nowiki></nowiki>
    • link:
  • Different page:
    • wikicode: <nowiki></nowiki>
    • link:


Replacing the default TOC
The auto-generated TOC is not maximally appropriate or useful in all article types, such as long and , so there are . To use one, put <nowiki></nowiki> at the top of the article, and place the alternative TOC template, such as (which can be customized for many list styles) where needed.


Section linking
In the HTML code for each section there is "id" attribute holding the section title. This enables directly to sections. These section anchors are automatically used by MediaWiki when it generates a table of contents for the page, and therefore when a section heading in the ToC is clicked, it will jump to the section. Also, the section anchors can be manually linked directly to one section within a page.

The HTML code generated at the beginning of this section, for example, is:

=Heading=

A link to this section () looks like this:

[[Article name#Section heading]]

To link to a section in the same page you can use __NOTOC__, and to link to a section in another page __FORCETOC__.

The anchors disregard the depth of the section; a link to a subsection or sub-subsection etc. will be __TOC__ and __FORCETOC__ etc.

An underscore and number are appended to duplicate section names. E.g. for three sections named "Example", the names (for section linking) will be "Example", "Example_2" and "Example_3". However, after editing section "Example_2" or "Example_3" (see below), one, confusingly, arrives at section "Example" from the .

If a section has a blank space as heading, it results in a link in the TOC that does not work. For a similar effect see .

To create an anchor target without a section heading, you can use the template or a span: __TOC__.

Notes:

  • Using the in section headings complicates section linking.
  • An internal link in a section heading does not give complications in terms of section linking, however editors who have their preferences set to edit sections by clicking on the header will not be able to click these links:
    • http://meta.wikimedia.org/wiki/Help:Section#Demo_http:.2F.2Fa
  • The does not work for section links:
    • __TOC__ ->
    • ===sub-sections=== ->
    • ====sub-sub-sections==== ->

For linking to an arbitrary position in a page see .


Section linking and redirects
A link that specifies a section of a redirect page corresponds to a link to that section of the target of the redirect.

A to a section of a page will also work, try e.g. the redirect page .

A complication is that, unlike renaming a page, renaming a section does not create any redirect from the old section name. Therefore incoming links to the old section name will have to be fixed.

There is no separate feature for sections: the list does not distinguish between links to one section or another and links to the entire page. Possible workarounds:

  • Instead of linking directly to a section, link to a page that redirects to the section; when the name of the section is changed, just change the redirect target. With this method, pages linking to the section can be identified by using What links here on the redirect page. The tool can be used to find existing section redirects.
  • Put an anchor and link to that
  • Put a comment in the wikitext at the start of a section listing pages that link to the section
  • Make the section a separate page/template and either transclude it into, or just link to it from, its parent page; instead of linking to the section one can then link to the separate page.

Redirect pages can be categorized by adding a category tag after the redirect command. In the case that the target of the redirect is a section, this has to some extent the effect of categorizing the section: through the redirect the category page links to the section; however, unless an explicit link is put, the section does not link to the category. On the category page, redirects are displayed with class redirect-in-category, so they can be shown in e.g. italics; this can be defined in . See also .


Section editing
Sections can be separately edited by clicking special edit links labeled "edit" by the heading or by right clicking on the section heading, depending on the set. This is called "section editing feature" ([[#toc]]). Section editing feature will take you to an edit page by a URL such as

Note that here section numbers are used, not section titles; subsections have a single number, e.g. section 2.1 may be numbered 3, section 3 is then numbered 4, etc. You can also directly type in such URLs in the address bar of your browser.

This is convenient if the edit does not involve other sections and one needs not have the text of other sections at hand during the edit (or if one needs it, open the section edit link in a new window, or during section editing, open the main page in a different window). Section editing alleviates some problems of large pages.

"[[#toc|Contents]]" anywhere on the page will remove the edit links. It will not disable section editing itself; the url and right-clicking on the section heading still work.

Inserting a section can be done by editing either the section before or after it, merging with the previous section by deleting the heading. Note that in these cases the preloaded section name in the edit summary is not correct, and has to be changed or deleted.


Missing "Edit" links
If the edit links are missing, click the "Edit" tab at the top of the page and then click "Save" without making any changes. See .


Adding a section at the end
Navigation on pages from "talk" namespaces provides a special link labeled "", " ", or "Add topic" used to create a new section to the end of the page. Pages having the code [[Help:Wiki markup#toc|Contents]] in wikitext also display this link, regardless of the namespace.

The URL for such an action looks like:

.

In this case, a text box having as title "", will appear and the content you type in it will become the name of the new section heading. There is no inputbox for the ; it is automatically created. Do not edit the last existing section to create a new one, because it will result in misleading edit summary which conceal creation of the section and may also attract one's attention to the previous section in vain.

See also , .


Editing before the first section
By default, there is no link to edit the lead section of a page, so the entire page must edited. Lead section editing can be enabled through .


Preview
The preview in section editing does not always show the same as the corresponding part of the full page, e.g. if on the full page an image in the previous section intrudes into the section concerned. Also, <ref>s usually become hidden; see for a solution.

The edit page shows the list of templates used on the whole page, i.e. also the templates used in other sections.


Subsections
Subsections are included in the part of the section that is edited. Section numbering is relative to the part that is edited, so on the relative top level there is always just number 1, relative subsections all have numbers starting with 1: 1.1., 1.2, etc.; e.g., when editing subsection 3.2, sub-subsection 3.2.4 is numbered 1.4. However, the heading format is according to the absolute level.


Editing a footnote
To edit a footnote rendered in a section containing the code __NOTOC__, edit the section with the footnote mark referring to it, see . However, the resulting text of the footnote is not shown in a preview of the section via "Show preview", so any mistake made by the editor will not be discovered until after the section edit is saved via "Save page". A workaround is to temporarily add a ==<span class="mw-headline" id="Section_linking">Section linking</span>== or [[Help:Section#Section linking|Section linking]] tag at the end of the section prior to previewing it. But after you are satisfied with the text of the reference shown in the preview, this temporary tag must be removed before the edit is saved.


Editing a page with large sections
If a page has very large sections, or is very large and has no division into sections, and one's browser or connection does not allow editing of such a large section, then one can still:
  • append a section by specifying a large section number (too large does not matter); however, one has to start with a blank line before the new section heading
  • append content to the last section by not starting with a section heading; however, with the limitations of one's browser or connection, one cannot revert this, or edit one's new text.

If one can view the wikitext of a large section, one can divide the page into smaller sections by step by step appending one, and finally deleting the original content (this can be done one large section at a time). Thus temporarily there is partial duplication of the content, so it is useful to put an explanation in the edit summary.


Sections within parser functions
When conditionally (using a ) transcluding a template with sections, edit links of this and subsequent sections will edit the wrong section or give the error message that the section does not exist (although the page (including TOC) is correctly displayed and the TOC links correctly). This is because for the targets of the edit links the content of conditionally included templates is considered part of the page itself, and the sections are counted after expansion.

Thus the edit links of the sections of the included template link to the page itself instead of the template, and the edit links after the included template link to the correct page but the wrong section number.

More generally conditional sections give such a complication.

The problem does not occur when transcluding a template with a conditional name (which has more advantages). Use for the template to transclude to produce nothing.


Sections vs. separate pages vs. transclusion
Advantages of separate pages:
  1. feature
  2. separate edit histories
  3. some template limits apply per page
  4. automatic redirect on renaming
  5. loading one small page is faster than loading one large page – but are readers more likely to want to use just one section or to browse many of the sections of the topic? – see advantages of combined pages
  6. can separately be put in categories (however, see also below)
  7. with : have separate annotations

Advantages of one combined page with sections:

  1. loading one combined page is faster and more convenient than loading several divided ones
  2. searching within one large page or its wikitext with a local search function is faster and has advantages over searching several pages using the site search engine or a web search engine
  3. the TOC provides for convenient navigation.
  4. more likelihood of editorial cohesion of a concept compared to having several definitions likely to be independently edited
  5. duplication of items relevant to each section, such as navigation templates and infoboxes is avoided

An alternative is (creating a by ). This allows easy searching within the combined rendered page, but not in the combined wikitext. As a disadvantage, a title for each page has to be provided. For the pre-expand include size limit this is disadvantageous even compared with one large page: the pre-expand include size is the sum of the pre-expand include sizes of the components plus the sum of sizes of the wikitexts of the components.


Headings
Section headings are styled with the HTML tags through as defined in the MediaWiki CSS. The styles are:

  • : font size 188%; bottom border
  • : font size 150%; bottom border
  • : font size 132%; bold
  • : font size 116%; bold
  • : font size 100%; bold
  • : font size 80%; bold

Some readers may have issues differentiating between , and . To make and bold, add this to or :

/* Bold h1 and h2 */ h1, h2 { font-weight: bold; } .editsection { font-weight: normal; }


Sections for demo above

Demo http://a
This section is linked to from .


See also
Manual of style

Account

Social:
Pages:  ..   .. 
Items:  .. 

Navigation

General: Atom Feed Atom Feed  .. 
Help:  ..   .. 
Category:  ..   .. 
Media:  ..   .. 
Posts:  ..   ..   .. 

Statistics

Page:  .. 
Summary:  .. 
1 Tags
10/10 Page Rank
2801 Page Refs