Template:TOC
This template is for a table of contents for long explanations.
Example Usage
Third-lever header
Fourth-level header
Third-level header
Exceptions
On the following three pages, this template deliberately outputs nothing, even when transcluded there indirectly (for example, as part of an explanation pulled in by Template:Nominate):
- explain xkcd:Explanation Improvement Project
- explain xkcd:Explanation Improvement Project/Successful nominations
- explain xkcd:Explanation Improvement Project/Unsuccessful nominations
This is because is a page-level magic word: once it's emitted anywhere in a page's rendered output, even from deep inside a transcluded template, it places a table of contents at that point on the page it's ultimately displayed on. Since these three pages each transclude many explanations via {{Nominate}}, an explanation that happens to use {{TOC}} would otherwise inject a floating table of contents into the nominations list, which isn't wanted there. The check is done with Template:TOC, so it correctly suppresses the output regardless of how many templates the transclusion passes through.