Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Sep 30 '12 at 23:18

This question came from our site for professional and enthusiast programmers.

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

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.