{% for section in site.table_of_contents %}
  • {{section.title}}
  • {% sorted_for p in site.pages sort_by:weight %} {% capture _filename %}{{ p.url | split:'/' | last }}{% endcapture %} {% if section.dir == '' %} {% capture _wanted %}{{ '/' | append:_filename }}{% endcapture %} {% else %} {% capture _wanted %}{{ '/' | append:section.dir | append:'/' | append:_filename }}{% endcapture %} {% endif %} {% capture _url %}{{ p.url | remove_first:'/' }}{% endcapture %} {% if p.url == _wanted %}
  • {{ p.title }} {% if p.url == page.url %} {{ content | toc }} {% endif %}
  • {% endif %} {% endsorted_for %} {% endfor %}