mirror of
https://github.com/SebastianStork/kita.git
synced 2026-01-21 14:31:35 +01:00
feat: add side toc support and update toc style
This commit is contained in:
parent
9d208b7bd1
commit
b7a197c648
10 changed files with 291 additions and 241 deletions
23
templates/partials/side_toc.html
Normal file
23
templates/partials/side_toc.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{% if page.toc and page.extra.side_toc | default(value=config.extra.side_toc) %}
|
||||
<nav
|
||||
class="prose prose-neutral dark:prose-invert prose-a:block prose-a:truncate prose-a:font-normal prose-a:secondary-link max-h-lvh overflow-y-auto px-2 pt-18 pb-4"
|
||||
>
|
||||
<b class="ml-1.5">Table of Contents</b>
|
||||
<ul>
|
||||
{% for h1 in page.toc %}
|
||||
<li>
|
||||
<a href="#{{ h1.id | safe }}">{{ h1.title }}</a>
|
||||
{% if h1.children %}
|
||||
<ul>
|
||||
{% for h2 in h1.children %}
|
||||
<li>
|
||||
<a href="#{{ h2.id | safe }}">{{ h2.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue