Display TOC in sidebar
This commit is contained in:
@ -29,6 +29,10 @@
|
||||
<li><a href="{{ get_url(path=item.path, trailing_slash=true) }}">{{ item.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if page.toc and not page.extra.notoc %}
|
||||
<span class="title">Table of Contents</span>
|
||||
{{ macros::toc() }}
|
||||
{% endif %}
|
||||
<span class="title">Categories</span>
|
||||
{{ macros::list_taxonomy(kind="categories") }}
|
||||
</nav>
|
||||
|
@ -48,24 +48,22 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro toc() %}
|
||||
{% if page.toc and not page.extra.notoc %}
|
||||
<ul>
|
||||
{% for h1 in page.toc %}
|
||||
<li>
|
||||
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
|
||||
{% if h1.children %}
|
||||
<ul>
|
||||
{% for h2 in h1.children %}
|
||||
<li>
|
||||
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<ul class="table-of-contents">
|
||||
{% for h1 in page.toc %}
|
||||
<li>
|
||||
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
|
||||
{% if h1.children %}
|
||||
<ul>
|
||||
{% for h2 in h1.children %}
|
||||
<li>
|
||||
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro list_taxonomy(kind, page=false, prepend="") %}
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ macros::toc() }}
|
||||
{{ page.content | safe }}
|
||||
{{ macros::page_info(page=page) }}
|
||||
{{ macros::page_updates(page=page) }}
|
||||
|
Reference in New Issue
Block a user