---
layout: archive
---

{{ content }}

<img src="/assets/images/top.jpg">

<h3>カテゴリ一覧</h3>

<ul class="taxonomy__index">
  {% for label in site.collections_order %}
    {% assign collection = site.collections | where: "label", label | first %}
    <li>
      <a href="#{{ collection.label | slugify | downcase }}">
        <strong>{{ collection.name }}</strong> <span class="taxonomy__count">{{ i }}</span>
      </a>
    </li>
  {% endfor %}
</ul>

{% comment %} Make sure that all collections are listed in the _config.yml. {% endcomment %}

{% assign entries_layout = page.entries_layout | default: 'list' %}
{% for label in site.collections_order %}
  {% assign collection = site.collections | where: "label", label | first %}
  <section id="{{ collection.label | slugify | downcase }}" class="taxonomy__section">
    <h2 class="archive__subtitle">{{ collection.name }}</h2>
    <div class="entries-{{ entries_layout }}">
      {% comment %} First, render ordered pages {% endcomment %}

      {% assign ordered_post = "" | split: "" %}
      {% if collection.order %}
        {% for file in collection.order %}
          {% assign docpath = "_" | append: collection.label | append: "/" | append: file %}
          {% assign post = collection.docs | where: "path", docpath | first %}
          {% if post %}
            {% include archive-single.html type=entries_layout %}
            {% assign ordered_post = ordered_post | push: docpath %}
          {% else %}
            <p style="color: #ff0000; font-weight: bolder">{{docpath}} not found!</p>
          {% endif %}
        {% endfor %}
      {% endif %}

      {% comment %} Second, render pages not listed in the order array {% endcomment %}

      {% for post in collection.docs %}
        {% assign already_rendered = ordered_post | where_exp: "path", "path == post.path" | size %}
        {% if already_rendered == 0 %}
          {% include archive-single.html type=entries_layout %}
        {% endif %}
      {% endfor %}
    </div>
    <a href="#page-title" class="back-to-top">{{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} &uarr;</a>
  </section>
{% endfor %}
