-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.html
executable file
·85 lines (72 loc) · 2.34 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
layout: page
title: Categories
exclude: true
---
{% for post in site.posts %}
{{ post.category }}
{% endfor %}
{% comment%}
Here we generate all the categories.
{% endcomment%}
{% assign rawcats = "" %}
{% for post in site.posts %}
{% assign tcats = post.category | join:'|' | append:'|' %}
{% assign rawcats = rawcats | append:tcats %}
{% endfor %}
{% assign rawcats = rawcats | split:'|' | sort %}
{% assign cats = "" %}
{% for cat in rawcats %}
{% if cat != "" %}
{% if cats == "" %}
{% assign cats = cat | split:'|' %}
{% endif %}
{% unless cats contains cat %}
{% assign cats = cats | join:'|' | append:'|' | append:cat | split:'|' %}
{% endunless %}
{% endif %}
{% endfor %}
<div class="posts">
<p>
{% for ct in cats %}
<a href="#{{ ct | slugify }}" class="codinfox-category-mark" style="color:#999;text-decoration: none;"> {{ ct }} </a>
{% endfor %}
<a href="#no-category" class="codinfox-category-mark" style="color:#999;text-decoration: none;"> No Category </a>
</p>
{% for ct in cats %}
<h2 id="{{ ct | slugify }}">{{ ct }}</h2>
<ul class="codinfox-category-list">
{% for post in site.posts %}
{% if post.category contains ct %}
<article class="post-item">
<p><span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span> — <strong><a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></strong>
<span style="float: right;">
{% for tag in post.tags %}[
<a class="codinfox-tag-mark" href="{{ site.url }}{{ site.baseurl }}/tags/#{{ tag | slugify }}">#{{ tag }}#</a>
]{% endfor %}
</span>
</p>
</article>
{% endif %}
{% endfor %}
</ul>
{% endfor %}
<h2 id="no-category">No Category</h2>
<ul class="codinfox-category-list">
{% for post in site.posts %}
{% unless post.category %}
<article class="post-item">
<p><span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span> — <strong><a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></strong>
<span style="float: right;">
{% if post.tags %}
[{% for tag in post.tags %}
<a class="codinfox-tag-mark" href="{{ site.url }}{{ site.baseurl }}/tags/#{{ tag | slugify }}">#{{ tag }}#</a>
{% endfor %}]
{% endif %}
</span>
</p>
</article>
{% endunless %}
{% endfor %}
</ul>
</div>