-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.html
43 lines (39 loc) · 1.15 KB
/
categories.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
layout: default
title: Categories
---
{% assign rawcategories = "" %}
{% for post in site.posts %}
{% assign tcategories = post.categories | join:'|' | append:'|' %}
{% assign rawcategories = rawcategories | append:tcategories %}
{% endfor %}
{% assign rawcategories = rawcategories | split:'|' | sort %}
{% assign categories = "" %}
{% for category in rawcategories %}
{% if category != "" %}
{% if categories == "" %}
{% assign categories = category | split:'|' %}
{% endif %}
{% unless categories contains category %}
{% assign categories = categories | join:'|' | append:'|' | append:category | split:'|' %}
{% endunless %}
{% endif %}
{% endfor %}
{% for category in categories %}
<h2 id="{{ category | slugify }}">{{ category }}</h2>
<ul>
{% for post in site.posts %}
{% if post.categories contains category %}
<li>
<h4>
<a href="{{ post.url }}">{{ post.title }}</a>
<br>
<small>{{ post.date | date_to_string }}</small>
<br>
Tags: {{ post.tags | join:' | ' }}
</h4>
</li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}