wiki.brainux.org/_layouts/categories.html

58 lines
2.1 KiB
HTML
Raw Permalink Normal View History

2021-12-04 19:33:31 +09:00
---
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 %}
2021-12-04 19:33:31 +09:00
<li>
<a href="#{{ collection.label | slugify | downcase }}">
<strong>{{ collection.name }}</strong> <span class="taxonomy__count">{{ i }}</span>
2021-12-04 19:33:31 +09:00
</a>
</li>
{% endfor %}
</ul>
2022-12-14 02:10:52 +09:00
{% comment %} Make sure that all collections are listed in the _config.yml. {% endcomment %}
2021-12-04 19:33:31 +09:00
{% 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 %}
2021-12-04 19:33:31 +09:00
{% 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 %}
2021-12-04 19:33:31 +09:00
{% 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 %}
2021-12-04 19:33:31 +09:00
{% 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 %}