{% assign path = page.path | remove: "/index.adoc" | remove_first: "_" | remove_first: page.collection | remove_first: "/" %}
{% assign current_guide = path | split: "/" | first %}
{% assign section = path | remove: current_guide | remove : "/" %}
{% if current_guide != nil %}
{% assign current_guide_url = current_guide | prepend: "/" %}
{% assign guide = site.data.toc | where: "url", current_guide_url | first %}
{% if section != "" %}
{% assign section_url = "/" | append: current_guide | append: "/" | append: section %}
{% assign sect = guide.items | where: "url", section_url | first %}
{% include section-toc.html section=sect title=false %}
{% else %}
{% for sect in guide.items %}
-
{% include section-toc.html section=sect title=true%}
{% endfor %}
{% endif %}
{% else %}
{% for guide in site.data.toc %}
{% if guide.items %}
{% for sect in guide.items %}
-
{% include section-toc.html section=sect title=true%}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}