Template:Hide inline TOC/doc: Difference between revisions

From Wikipedia, the free encyclopedia

Content deleted Content added


 

Line 8: Line 8:

Non–Vector 2022 TOCs are inside <code>.mw-parser-output</code>, so one could just have TemplateStyles with <syntaxhighlight lang=”css” inline>#toc { display: none; }</syntaxhighlight> and it would hide the TOC for all non–Vector 2022 skins. However, many custom TOC templates like {{tl|Compact TOC}} automatically add <code>id=”toc”</code>, so it is not so simple.

Non–Vector 2022 TOCs are inside <code>.mw-parser-output</code>, so one could just have TemplateStyles with <syntaxhighlight lang=”css” inline>#toc { display: none; }</syntaxhighlight> and it would hide the TOC for all non–Vector 2022 skins. However, many custom TOC templates like {{tl|Compact TOC}} automatically add <code>id=”toc”</code>, so it is not so simple.

There is a relevant discussion at {{Section link|phab:T317818#8778839}}

There is a relevant discussion at {{Section link|phab:T317818#8778839}}

== Usage ==

== Usage ==


Latest revision as of 18:57, 29 January 2026

This template displays the TOC on the left-hand sidebar on the Vector 2022 skin, while hiding it in other skins. This is useful when a TOC is useful for navigating the page with the sidebar, but is too large to be displayed inline in the legacy skin. It only contains the following:

<div style="display:none">__FORCETOC__</div>

The Vector 2022 skin has the TOC on the sidebar, thus the TOC is not inserted inside articles (inline). However, some TOC templates automatically hide the TOC, and other pages manually hide it by using the _NOTOC_ magic word. This makes browsing lists much harder. Many of these pages are alphabetical lists, where having a TOC is useful for navigation.

Non–Vector 2022 TOCs are inside .mw-parser-output, so one could just have TemplateStyles with #toc { display: none; } and it would hide the TOC for all non–Vector 2022 skins. However, many custom TOC templates like {{Compact TOC}} automatically add id="toc", so it is not so simple.

There is a relevant discussion at Wikipedia talk:Manual of Style/Glossaries § Compact ToC hostile to Vector2022 users and phab:T317818 § 8778839.

Place {{Hide inline TOC}}, or its redirect, {{Hit}}, anywhere on the page, preferably at the top.

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version