mirror of
https://github.com/SebastianStork/kita.git
synced 2026-01-21 13:21:35 +01:00
feat: add TOC
This commit is contained in:
parent
f46a830abf
commit
66b48ea8d7
3 changed files with 58 additions and 0 deletions
|
|
@ -6,6 +6,38 @@
|
|||
{% include "partials/page_info.html" %}
|
||||
</header>
|
||||
|
||||
{% if page.toc %}
|
||||
<div class="mb-12 flex rounded-lg bg-black/[3%] p-2 text-lg dark:bg-white/[8%]">
|
||||
<details>
|
||||
<summary class="cursor-pointer py-1 pl-4">
|
||||
<span>Table of Contents</span>
|
||||
</summary>
|
||||
<div class="px-2">
|
||||
<ul>
|
||||
{% for h1 in page.toc %}
|
||||
<li>
|
||||
<a class="no-underline hover:underline" href="{{ h1.permalink | safe }}"
|
||||
>{{ h1.title }}</a
|
||||
>
|
||||
{% if h1.children %}
|
||||
<ul>
|
||||
{% for h2 in h1.children %}
|
||||
<li>
|
||||
<a class="no-underline hover:underline" href="{{ h2.permalink | safe }}"
|
||||
>{{ h2.title }}</a
|
||||
>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<section>{{ page.content | safe }}</section>
|
||||
|
||||
<hr />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue