Table of Contents

From mw.mh370.wiki
Jump to navigation Jump to search


A Guide to Using MediaWiki in a Hosted Environment

An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.


Table of Contents

MediaWiki automatically generates a Table of Contents (TOC) when more than three section headings are used on a page.

This behaviour can be controlled on a per-page basis using magic words:-

__NOTOC__
Hides the Table of Contents
__TOC__
The Table of Contents is positioned wherever this magic word is placed.
__FORCETOC__
Forces the Table of Contents to appear at its normal position (before the first header, overriding __NOTOC__).

Some Issues:-
  1. If used on a page, the magic word __NOTOC__ may create unwanted white space equivalent to an empty line.
  2. On the mh370wiki.net website I did not want an automatic Table of Contents on any page. Instead of placing __NOTOC__ on every page I disabled the TOC globally by adding a style to MediaWiki:Common.css[1]
    .toc, #toc { display: none; } /* hide Table of Contents on ALL pages */
    
  3. With the Table of Contents hidden globally, neither __TOC__ nor __FORCETOC__ could place a Table of Contents on a page. Using MediaWiki 1.43.1 with the Vector Skin and the css in Common.css commented out, a page with multiple h2 and h3 headings displayed a TOC as expected. But with the css enabled, the same page did not have a Table of Contents when either __TOC__ or __FORCETOC__ were added to the page.


Notes:-