{% if locale === "de" %}
  {% set prefix = "/" %}
{% else %}
  {% set prefix = "/" + locale + "/" %}
{% endif %}

<section class="homepage-toc">
  <h2 class="homepage-toc-title">{{ i18n[locale].homepage.tocHeadline }}</h2>
  <nav>
    <ol class="homepage-toc-intro">
      {% for item in prefaceCollection %}
      <li>
        <a href="{{ prefix }}{{ item.slug }}/">{{ item.title }}</a>
      </li>
      {% endfor %}
    </ol>
    <ol class="homepage-toc-content">
    {% for chapter in tocCollection %}
    <li class="homepage-toc-chapter">
      {{ chapter.title }}
      <ol>
        {% for section in chapter.items %}
        <li class="homepage-toc-">
          <a href="{{ prefix }}{{ section.slug }}/">
            {{ section.title }}
          </a>
        </li>
        {% endfor %}
      </ol>
    </li>
    {% endfor %}
    </ol>
  </nav>
</section>
