{% for toc_item in toc %} {% for toc_h2_item in toc_item.children %} <li class=""><a href="{{ toc_h2_item.url }}">{{ toc_h2_item.title }}</a></li> {% for toc_h3_item in toc_h2_item.children %} <h3><a href="{{ toc_h3_item.url }}">{{ toc_h3_item.title }}</a></h3> {% endfor %} {% endfor %} {% endfor %}