37 lines
1.3 KiB
HTML
37 lines
1.3 KiB
HTML
<!-- TOC -->
|
|
{%- if page.extra.toc is defined %}
|
|
{%- set page_toc = page.extra.toc %}
|
|
{%- elif section.extra.toc is defined %}
|
|
{%- set page_toc = section.extra.toc %}
|
|
{%- elif config.extra.toc is defined %}
|
|
{%- set page_toc = config.extra.toc %}
|
|
{%- endif %}
|
|
{%- if page_toc and (page.toc or section.toc) %}
|
|
<div class="block-bg mb-12 rounded-lg p-2 text-lg">
|
|
<details {%- if page_toc is object and page_toc.open %}{{ ` open` }}{% endif %}>
|
|
<summary class="select-none py-0.5 lg:py-1 pl-4" accesskey="=">
|
|
<span class="cursor-pointer">{{ m_i18n::tr(key=`word_toc`, lk=g_lang_k, d=g_trans_d) }}</span>
|
|
</summary>
|
|
<div class="px-2">
|
|
<ul>
|
|
{%- for h1 in page.toc | default(value=section.toc) %}
|
|
<li>
|
|
<a class="no-underline hover:underline" href="{{
|
|
m_url::rel(there=h1.permalink, here=g_here, base=g_base) }}">{{ h1.title }}</a>
|
|
{%- if h1.children %}
|
|
<ul>
|
|
{%- for h2 in h1.children %}
|
|
<li>
|
|
<a class="no-underline hover:underline" href="{{
|
|
m_url::rel(there=h2.permalink, here=g_here, base=g_base) }}">{{ h2.title }}</a>
|
|
</li>
|
|
{%- endfor %}
|
|
</ul>
|
|
{%- endif %}
|
|
</li>
|
|
{%- endfor %}
|
|
</ul>
|
|
</div>
|
|
</details>
|
|
</div>
|
|
{%- endif %}
|