4

I'm running my own installation of MediaWiki, which has been great! I haven't been able to find the answer to this small problem in any post, how to, etc. Here's the setup:

Article

TOC (limited to showing only H1 and H2)
==H1==
===H2===
====H3====
====H3====

I don't want the H3 to show up on the main table of contents, because it would make the list very long. Instead, under the H2, I would like to display another TOC with all the H3's under that listing.

From my understanding, you cannot have multiple table of contents on a single page. I've thought about making a template for each H2 that has the H3 links, but that seems like it duplicates a lot of work and creates loads of pages. I'd love a template that sucks all subsection names and spits them out, but I don't see how to do that.

Alternatively, is there a way to enable multiple TOCs in a custom install of MediaWiki that I'm missing? Even that would get closer to what I'm trying to do.

  • Uh, custom tocs are very limited in MediaWiki... – Bergi Sep 27 '12 at 17:15
1

Not an exact answer, but perhaps an idea: You could split your page to single pages for your top-level chapters and create a TOC yourself by using a template which is included in every of these pages; e.g.:

Template:My-linked-pages-TOC:

<div style="border:thin gray;padding:0.5em;margin:0.5em 0;">
# [[First top-level chapter]]
# [[Second top-level chapter]]
...
# [[Last top-level chapter]]
</div>

Then you could use {{My-linked-pages-TOC}} at the beginning of each page. The current page will be rendered bold, while the others will be linked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy