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?