Trifle::Docs / How to Guides / Table of Content
Learn how to display Table of Content section.

Table of Content

Markdown harvester automatically generates Table of Content for you. All you need is to position it where you want it and print it out. As it's autogenerated, there is not much customisation you can do. It's all just nested lists with links.

To help with styling, do some HTML & CSS magic. Put some ID on the tag wrapping TOC and style only lists and links inside of it.

<nav id="on-this-page">
  <h2 id="on-this-page-title">On this page</h2>
  <%= meta.dig('toc') %>