mirror of
https://github.com/brain-hackers/wiki.brainux.org
synced 2025-10-19 14:48:41 +09:00
First implementation
This commit is contained in:
93
_layouts/categories.html
Normal file
93
_layouts/categories.html
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
layout: archive
|
||||
---
|
||||
|
||||
{{ content }}
|
||||
|
||||
{% assign stay_on_top = site.stay_on_top_categories %}
|
||||
|
||||
{% assign categories_max = 0 %}
|
||||
{% for category in site.categories %}
|
||||
{% if category[1].size > categories_max %}
|
||||
{% assign categories_max = category[1].size %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<img src="/assets/images/top.jpg">
|
||||
|
||||
<h3>カテゴリ一覧</h3>
|
||||
|
||||
<ul class="taxonomy__index">
|
||||
{% comment %} Iterate the Stay-on-Top list and all categories and render matched categories {% endcomment %}
|
||||
|
||||
{% for category in site.categories %}
|
||||
{% for stay in stay_on_top %}
|
||||
<!--<p>category[0] = `{{ category[0]}}`, stay = `{{ stay }}`</p>-->
|
||||
{% if category[0] == stay %}
|
||||
<li>
|
||||
<!-- Stay on top -->
|
||||
<a href="#{{ category[0] | slugify }}">
|
||||
<strong>{{ category[0] }}</strong>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% comment %} Iterate the Stay-on-Top list and all categories and render unmatched categories {% endcomment %}
|
||||
|
||||
{% for category in site.categories %}
|
||||
{% assign skip = false %}
|
||||
{% for stay in stay_on_top %}
|
||||
{% if category[0] == stay %}
|
||||
{% assign skip = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if skip %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="#{{ category[0] | slugify }}">
|
||||
<strong>{{ category[0] }}</strong> <span class="taxonomy__count">{{ i }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% assign entries_layout = page.entries_layout | default: 'list' %}
|
||||
{% for category in site.categories %}
|
||||
{% for stay in stay_on_top %}
|
||||
{% if category[0] == stay %}
|
||||
<section id="{{ category[0] | slugify | downcase }}" class="taxonomy__section">
|
||||
<h2 class="archive__subtitle">{{ category[0] }}</h2>
|
||||
<div class="entries-{{ entries_layout }}">
|
||||
{% for post in category.last %}
|
||||
{% include archive-single.html type=entries_layout %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<a href="#page-title" class="back-to-top">{{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} ↑</a>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% for category in site.categories %}
|
||||
{% assign skip = false %}
|
||||
{% for stay in stay_on_top %}
|
||||
{% if category[0] == stay %}
|
||||
{% assign skip = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if skip %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
<section id="{{ category[0] | slugify | downcase }}" class="taxonomy__section">
|
||||
<h2 class="archive__subtitle">{{ category[0] }}</h2>
|
||||
<div class="entries-{{ entries_layout }}">
|
||||
{% for post in category.last %}
|
||||
{% include archive-single.html type=entries_layout %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<a href="#page-title" class="back-to-top">{{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} ↑</a>
|
||||
</section>
|
||||
{% endfor %}
|
Reference in New Issue
Block a user