Help:Section/de
![]() |
Hinweis: Wenn Du diese Seite bearbeitest, stimmst Du zu, dass Dein Beitrag unter der [CC0] veröffentlicht wird. Mehr Informationen findest du auf der Public Domain Hilfeseite. | ![]() |
Die Abschnittskopfzeilensyntax ermöglicht die Unterteilung einer Seite in Abschnitte.
Abschnittserstellung und Nummerierung
Um einen Abschnitt zu erstellen, definiere seine Überschriften wie folgt:
== Abschnitt == === Unterabschnitt === ==== Unter-Unterabschnitt ====
Richtlinien zur Verwendung von Abschnittsüberschriften
- Überschriften mit nur einem Gleichheitszeichen auf einer Seite (
=Text hier=
) führen zu einem Titel in der Größe des Seitennamens. - Die Abschnittsüberschrift kann nicht mit anderen Inhalten in derselben Zeile kombiniert werden. Beispielsweise wird mit
==Abschnittsüberschrift==<br>
keine Überschrift, sondern ein Absatz gerendert. - Abschnittsnamen sollten innerhalb einer Seite eindeutig sein, einschließlich der Unterabschnittsnamen. Zu den Nachteilen doppelter Abschnittsnamen gehören:
- Verwirrung beim Bearbeiten - Mehrere Abschnitte mit demselben Titel können zu Verwirrung bei der Bearbeitung führen, was zu Fehlern führt und es für Mitwirkende schwierig macht, Inhalte genau zu bearbeiten.
- Mehrdeutige Bearbeitungszusammenfassungen - MediaWiki generiert Bearbeitungszusammenfassungen für Seitenbearbeitungen, aber wenn mehrere Abschnitte denselben Titel haben, können diese mehrdeutig werden. Beispielsweise könnte die Bearbeitungszusammenfassung zweier Abschnitte zum Thema 'Diät' lauten: 'Ich habe den Abschnitt Diät bearbeitet.' Dies verwirrt die Mitwirkenden und erschwert die effektive Überprüfung der jüngsten Änderungen.
- Du kannst mithilfe einer Vorlage/Seite separate Abschnitte auf verschiedenen Seiten mit eigenen Bearbeitungsverläufen erstellen. Jede Vorlage/Seite kann in eine Hauptseite eingefügt werden, wodurch Inhalte hinzugefügt werden können, ohne das Gesamtbild zu verändern. Dieses Setup erleichtert die Nachverfolgung von Änderungen und die Verwaltung bestimmter Teile einer Seite. (Siehe Hilfe:Vorlage#Möglichkeiten zur Verwendung von Vorlagen.)
- Eine Vorlage mit Abschnitten auf einer neuen Seite behält ihre ursprüngliche Reihenfolge bei und verbindet Inhalte vor und nach der Vorlage. Dadurch wird eine korrekte Nummerierung der Abschnitte innerhalb der Vorlage sichergestellt, ohne die Nummerierung der Abschnitte auf der Hauptseite zu beeinträchtigen. Diese Funktion wird in Skins nicht unterstützt, die ein Inhaltsverzeichnis außerhalb des Artikelinhalts anzeigen, wie z. B. im Vector 2022 Skin.
- Eine Abschnittsüberschrift im Wikitext auf MediaWiki wird durch den regulären Ausdruck
/(^={1,6}.*?={1,6}\s*?$)/m
angegeben (m
bezieht sich auf einen Mehrzeilenmodus).
Inhaltsverzeichnis (Table of contents = TOC)
Für Seiten mit mehr als drei Abschnittsüberschriften wird automatisch ein Inhaltsverzeichnis (TOC) generiert.
Redakteure können das Inhaltsverzeichnis jedoch ausschließen, indem sie das magische Wort __NOTOC__
(eingeschlossen in doppelte Unterstriche) in das Bearbeitungsfeld des Artikels einfügen.
Richtlinien zur Verwendung des Inhaltsverzeichnisses
- Ein Inhaltsverzeichnis wird dem Wikitext hinzugefügt und überschreibt __NOTOC__, wenn entweder __FORCETOC__ oder __TOC__ (mit zwei Unterstrichen auf beiden Seiten des Begriffs) hinzugefügt wird, selbst wenn die Seite weniger als vier Überschriften hat.
- Die Verwendung von __FORCETOC__ erzwingt, dass das Inhaltsverzeichnis (TOC) vor der ersten Abschnittsüberschrift angezeigt wird, während __TOC__ es dort platziert, wo das Inhaltsverzeichnis beginnen soll, und so eine flexible Positionierung, beispielsweise rechts oder innerhalb einer Tabellenzelle, ermöglicht.
- __TOC__ hilft dabei zu steuern, wo das Inhaltsverzeichnis (TOC) in einem Artikel erscheint. Platziere __TOC__ dort, wo das Inhaltsverzeichnis angezeigt werden soll, etwa nach einer Einleitung oder am Ende der Seite. Dadurch wird sichergestellt, dass sich das Inhaltsverzeichnis an der richtigen Stelle befindet, ohne dass zusätzliche Überschriften erforderlich sind.
- Die Verwendung von __NOTOC__ verhindert, dass das automatische Inhaltsverzeichnis auf einer Seite angezeigt wird. Wenn Du ein einfaches Inhaltsverzeichnis erstellen möchtest, kannst Du manuell Links zu verschiedenen Abschnitten auf der Seite erstellen, indem Überschriften wie == A == verwendet werden und diese dann mit Abschnittslinks wie diesem [[#A|A]]" verlinken.
Zusammenfassung:
Wort | Erklärung |
---|---|
__NOTOC__ | Das Inhaltsverzeichnis (ToC) der aktuellen Seite ist ausgeblendet. |
__FORCETOC__ | Bewirkt, dass das Inhaltsverzeichnis angezeigt wird. |
__TOC__ | Fügt irgendwo auf der Seite ein Inhaltsverzeichnis hinzu und überschreibt somit alle __NOTOC__. Wenn es mehrere __TOC__-Zauberwörter gibt, wird nur das erste wirksam. |
Verschieben des Inhaltsverzeichnisses
Der folgende Code ermöglicht es, das Inhaltsverzeichnis als schwebende Tabelle auf der rechten Seite des Bildschirms zu positionieren.
{| align="right"
| __TOC__
|}
Globale Begrenzung der Inhaltsverzeichnistiefe
Die Tiefe des Inhaltsverzeichnisses (TOC) lässt sich steuern, indem die Einstellung $wgMaxTocLevel in der Datei LocalSettings.php
angepasst wird.
Wird der Wert beispielsweise auf 3 gesetzt, wird das Inhaltsverzeichnis so beschränkt, dass nur bis zu drei Ebenen tief angezeigt werden.
Verlinken mit einem Abschnitt
Abschnittsüberschriften generieren automatisch HTML mit dem Attribut id
, auf das entweder innerhalb derselben Seite oder von anderen Seiten aus direkt verlinkt werden kann.
Der HTML-Code, der am Anfang dieses Abschnitts auf der englischen Version dieser Seite erstellt wurde, lautet beispielsweise:
<h2><span class="mw-headline" id="Linking_to_a_section">Linking to a section</span></h2>
Ein Link hierzu (Abschnitt) sieht folgendermaßen aus:
[[Help:Section/de#Linking to a section|Abschnittsverknüpfung]]
Mit [[#Abschnittslink|angezeigter Text]]
lässt sich auf einen Abschnitt innerhalb einer Seite verlinken und mit [[Seitenname#Abschnittsname|angezeigter Text]]
auf einen Abschnitt innerhalb einer anderen Seite.
Ein Link zu einem Unterabschnitt, Unterunterabschnitt usw. beträgt [[#Unterabschnittsname]]
und [[#Unter-Unterabschnittsname]]
usw., da die Anker die Tiefe des Abschnitts nicht berücksichtigen.
Doppelte Abschnittsnamen werden durch Anhängen eines Unterstrichs und einer Zahl gekennzeichnet. Wenn es beispielsweise drei Abschnitte mit dem Namen "Beispiel" gibt, werden diese mit "Beispiel", "Beispiel_2" und "Beispiel_3" beschriftet. Beim Bearbeiten der Abschnitte "Beispiel_2" oder "Beispiel_3" verweist die Bearbeitungszusammenfassung jedoch verwirrenderweise auf "Beispiel". Eine leere Überschrift in einem Abschnitt verzerrt das Inhaltsverzeichnis (TOC).
Verknüpfen von Abschnitten mithilfe einer beliebigen ID
Abschnittslinkanker können sich ohne Vorankündigung ändern, insbesondere wenn ein Artikel mehrere Abschnitte mit demselben Namen enthält.
Zur Unterscheidung dieser Abschnitte werden zusätzliche Kennungen wie " 2", " 3" usw. hinzugefügt.
Wenn ein Abschnitt hinzugefügt, gelöscht oder umbenannt wird, kann sich das Ziel des Links ändern, was möglicherweise zu falschen oder nicht vorhandenen Abschnitten führt.
Dies kann mit dem HTML-Tag <span>
und dem Attribut id
vermieden werden:
<span id="Anker_Name"></span>
Bitte stelle sicher, dass der gewählte Name eindeutig ist, indem Du abgekürzte Titel aus übergeordneten Abschnitten integrierst, wie z. B. Ontario-Natural_features
für den Unterabschnitt "Natural Features" im Abschnitt "Ontario" eines Artikels über die kanadischen Provinzen.
Diese Methode funktioniert möglicherweise nicht auf älteren Browsern, insbesondere denen vor MediaWiki 1.4.10, und sie funktioniert möglicherweise sogar mit modernen Browsern nicht, wenn id
Leerzeichen enthält.
Zum Beispiel:
<span id="Ontario–Natürliche Besonderheiten">(optionaler Text)</span> [Wird nicht funktionieren] <span id="Neufundland-Naturmerkmale">(optionaler Text)</span> [Wird funktionieren] ... Siehe [[#Ontario–Natürliche Besonderheiten|Natürliche Merkmale von Ontario]] und [[#Neufundland-Naturmerkmale|Naturmerkmale von Neufundland]]
Ersetze Leerzeichen in der ID durch Unterstriche, um sicherzustellen, dass Links sowohl mit Unterstrichen als auch mit Leerzeichen reibungslos funktionieren.
- Interne Links in Abschnittsüberschriften erschweren die Abschnittsverlinkung nicht:
- Abschnittslinks sind nicht mit dem Pipe-Trick kompatibel:
[[#section|]]
-> [[#section|]][[page#section|]]
-> [[page#section|]][[namespace:page#section|]]
-> [[namespace:page#section|]]
Informationen zum Verlinken zu beliebigen Abschnitten einer Seite sind unter manuelle Anker zu finden.
Verlinken von Abschnitten und Weiterleitungen
Linking to a specific section of a page through a Help:redirect usually functions similarly to linking directly to that section.
Renaming a page generates a redirect, but renaming a section does not. Additionally, there is no distinct backlink feature for sections ; pages linking to a section are listed among pages linking to the entire page. To address these issues:
- Instead of directly linking to a section, use a page that redirects to the section. This approach facilitates tracking changes to section names and provides a "what links here" functionality for sections. To identify links to the section, check for redirects linking to the page and select the relevant one.
- Insert an anchor within the section and link to it accordingly.
- Add a comment at the beginning of a section in the wikitext, listing pages that link to that section.
- Create a separate page or template for the section and either transclude it into the parent page or link to it. Then, instead of linking directly to the section, link to the separate page or template.
Redirect pages can be put into categories by adding a category tag after the redirect command. If the redirect leads to a section, it somewhat categorizes that section too. However, the section will not link back to the category unless specifically done. On category pages, redirects are shown in italics. For more details, check out w:Wikipedia:Categorizing redirects.
Editing sections
To edit specific sections of a page, you can click on the [Bearbeiten]
link next to the section heading.
Clicking on these links takes you to an edit page with a URL structured like this:
https://www.mediawiki.org/w/index.php?title=Help:Advanced_editing&action=edit§ion=9
Instead of using section titles, section editing uses section numbers.
Subsections are represented with a single number (e.g., In the link above, section 2 in the table of content is numbered as 9 in the link.
This allows for focused editing without the need to have the entire text of the page visible.
It is particularly useful for large pages, as it simplifies the editing process and reduces clutter.
Adding __NOEDITSECTION__
section editing via a URL you already have still works.
When inserting a section, edit the previous or following section, merge by deleting the heading if necessary, and adjust the edit summary accordingly.
Including a section at the end
To add a new section at the end of a page, you can use a URL like the following:
https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit§ion=new
On talk pages and pages with wikitext, you can use the code __NEWSECTIONLINK__
to generate a special link beside the edit tab titled "⧼skin-action-newsection⧽".
Clicking this link will open a text box where you can enter a headline for the new section.
The edit summary is automatically generated.
The edit summary produced will be /* Section Name */ Neuer Abschnitt /* Section Name */
, which is automatically rendered as a right arrow.
This leaves no option for providing a custom edit summary.
If the subject box is left blank, no empty == ==
delimiter is inserted, and the content is appended to the page's last section.
This approach does not support creating a new section without a title and does not allow for providing an edit summary.
The "Preloadtitle" parameter determines the first text displayed in the "Subject/headline" field:
https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit§ion=new&preloadtitle=pqr
The preload can be edited before it is saved.
Editing before a first section
Generally, there is no designated link for editing the introductory text before the first section heading (phab:T2156). However, you can apply the section editing feature to this part by using 0 as the section number in the link, like this:
https://www.mediawiki.org/w/index.php?title=Help:Advanced_editing&action=edit§ion=0
Alternatively, you can modify any section edit link on the page by changing the section number.
To generate the same URL using JavaScript, see w:Wikipedia:WikiProject User scripts/Scripts/Edit Top.
Preview
Section editing preview may differ from the full page if an image from a previous section overlaps with the current section.
The edit page displays all templates used on the entire page, including those from other sections.
Working with subsections
When editing a section, subsections are included and numbered relative to the edited part, starting at 1. Subsections are denoted with numbers like 1.1, 1.2, etc. The heading format follows the absolute level, with sub-subsections numbered accordingly. For example, a sub-subsection 3.2 would be numbered 3.2.1, 3.2.2
Editing a page with large sections
If a page has large sections or lacks division into sections, users can still modify the content by:
- Starting with a blank line before the new section heading, and adding a section with a specified large section number.
- Adding content to the last section without a heading, but unable to revert or edit the new text due to browser or connection limitations.
Editing sections of included templates
You can edit sections within included pages or templates.
Clicking the edit link for a section takes you to the edit page of the separate page.
This section (transcluded from Help:Section/Editing sections of included templates ) shows how it works.
The size of the section within the included page or template is determined by the headings in the main page where it is included. Also, texts before the first heading of the separate page is part of the section, but clicking its edit link won't show its text. Similarly, if there are texts after the template tag without a heading, you need to click the headings before the template to edit it. This section shows how it works. To ensure clarity and consistency in rendered parent pages, follow these guidelines:
- Template structure - Avoid placing any text before the first heading within a template.
- Handling sections - After using a template with sections, start a new section on the parent page. This prevents conflicts between template sections and parent page sections.
Additionally, consider the following practices for managing templates effectively:
- Template heading - Sometimes it's helpful to start a template with a heading, even if it's just one section. This makes editing easier.
- Parameter use - When editing templates, remember parameters, such as
{{{1}}}
, are changed in the calling page, not directly in the template. Although this may not be immediately apparent in the rendered page, providing explanatory text or an additional edit link can enhance user understanding. - NOEDITSECTION tag - The __NOEDITSECTION__ tag affects the template and any pages it's added to, along with other templates on the same page. Instead, consider replacing MediaWiki section header markup with HTML header markup within the template, causing the headers to remain visually consistent while avoiding recognition as editable sections. This approach eliminates the need for __NOEDITSECTION__ within the template.
For example, think of a template structured as follows:
==Template heading 1==
Content
===Template heading 2===
Content
To prevent "edit section" links from appearing when transcluding a template, add NOEDITSECTION within the template's code. However, this suppresses all "edit section" links on pages where the template is used.
Alternatively, structuring the template with HTML heading tags (<h2>
, <h3>
, etc.) achieves the same visual effect without affecting other sections' edit links on transcluding pages.
<h2>Template heading 1</h2>
Content
<h3>Template heading 2</h3>
Content
Sections within a parser function
When conditionally transcluding a template with sections using a parser function , the edit links for these sections may direct to the wrong section or show an error message claiming the section does not exist. This occurs because the content of conditionally included templates is considered part of the page itself, causing the sections to be counted after expansion.
As a result, the edit links for sections within the included template link to the page instead of the template, and the subsequent edit links refer to the correct page but with incorrect section numbers. This issue does not arise when transcluding a template with a conditional name, which offers additional advantages.
Editing footnotes
To edit a footnote in a section using <references />
, find the section with the footnote mark and edit it.
Check Help:Footnotes for more help.
Viewing a section
You can use the section editing feature to view a specific section without loading the entire page.
Sections vs. separate pages vs. transclusion
Here are some advantages of each of them:
Advantages of one large page with sections:
- Faster access and simpler searching compared to accessing multiple smaller pages.
- Maintains conceptual cohesion for complex topics.
Advantages of separate pages:
- Easy navigation and editing with separate links and histories using the what links here feature.
- Faster loading times due to smaller page sizes.
- Automatic redirection upon renaming.
- Improved organization and data management through independent categorization and annotation.
- A few templates limit the apply per page.
Advantages of compound documents by Transklusion :
- Transklusion involves including the content of one page within another, often accomplished through templates.
- Users can navigate and search within the combined rendered page, which enhances usability.
Disadvantages:
- Users cannot search within the combined wikitext directly.
- Providing titles for each included page can be cumbersome.
- There is a limitation related to the size of post-expand includes, potentially causing technical issues, particularly with large or numerous included pages.
Sections and Table of Content (ToC)
Adding Non-Section Text to TOC
You can mark text as a TOC entry by using <h4>...</h4>
header tags.
Customize formatting as usual inside these tags.
An Example usage (the second one is better formatted for clarity):
{| class="collapsible collapsed" style="text-align:left; border:0px; margin-top:0.2em" |- ! style="background-color:#f2dfce" | <h4>Stuff</h4> |- | Contents about stuff here |} {| class="collapsible collapsed" style="text-align:left; border:0px; margin-top:0.2em" |- ! style="background-color:#f2dfce; padding-top:0; padding-bottom:0" | <h4 style="margin:0; padding:0;font-size:95%">More stuff</h4> |- | Contents about more stuff here |}
To clarify, you want the collapse boxes headers treated as section titles, included in the table of contents (TOC), without necessitating formal "section titles" on the page itself.
Although not recommended, it is possible to create a TOC entry that is not in the text but acts as an anchor for linking to a section header with slightly different wording:
<h4 style="display:none">Your heading here</h4>
Sections for the above demo
Demo abc
This section is linked to from #Linking to a section.