templates/partials/toc.html (446B)
1 {#- 목차. page.toc_entries 는 항상 채워지고, 보일지 말지는 front matter 의 toc 가
2 정한다. 데이터와 의사를 갈라 두면 긴 글에서만 목차를 내는 판단을 템플릿이 할 수 있다. #}
3 {% macro toc_list(entries) %}
4 <ul>
5 {%- for e in entries %}
6 <li>
7 <a href="#{{ e.id }}">{{ e.title }}</a>
8 {%- if e.children %}{{ toc_list(e.children) }}{% endif %}
9 </li>
10 {%- endfor %}
11 </ul>
12 {% endmacro %}