Table of contents customization

I’m just getting started with Middleman and were wondering if it would be possible to implement a collapsible table of contents that would collapse at the index of the users page. The end goal is to have it look similar to the left TOC of https://pmarsceill.github.io/just-the-docs/. What would be the best way to approach the problem?

Depending on whether you are planning to use blog-plugin or not, you have to traverse the Sitemap (if not using a blog-plugin) or just generate the TOC based on blog functions (articles, tags, etc.). A separate problem is presentation. Middleman by itself does not provide any rich-templates with such niceties as collapsible TOC, it’s more versatile but also bare-bones system, compared to Jekyll. So you would have to find/implement some JS/CSS solution of your own. Unless someone can point us to some recent and decent template sets for Middleman?

1 Like

I found a gem https://github.com/svenfuchs/middleman-toc/ that seems to do the trick. Thanks for your help!