-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcategory.html
116 lines (97 loc) · 2.33 KB
/
category.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
layout: default
title: Categories
---
{% comment%}
Here we generate all the categories.
{% endcomment%}
{% assign rawcats = "" %}
{% for post in site.posts %}
{% assign tcats = post.categories | 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 %}
{% comment%}
Here we generate all the tags.
{% endcomment%}
{% assign rawtags = "" %}
{% for post in site.posts %}
{% assign ttags = post.tags | join:'|' | append:'|' %}
{% assign rawtags = rawtags | append:ttags %}
{% endfor %}
{% assign rawtags = rawtags | split:'|' | sort %}
{% assign tags = "" %}
{% for tag in rawtags %}
{% if tag != "" %}
{% if tags == "" %}
{% assign tags = tag | split:'|' %}
{% endif %}
{% unless tags contains tag %}
{% assign tags = tags | join:'|' | append:'|' | append:tag | split:'|' %}
{% endunless %}
{% endif %}
{% endfor %}
<h1 class="page-title">
{{ page.title }}
</h1>
<br/>
<div class="after-post-tags">
<ul class="tags">
{% for ct in cats %}
{% unless tags contains ct %}
<li>
<a href="#{{ ct | slugify }}">{{ ct }}</a>
</li>
{% endunless %}
{% endfor %}
<li>
<a href="#no-category">No Category</a>
</li>
</ul>
</div>
{% for ct in cats %}
{% unless tags contains ct %}
<h2 id="{{ ct | slugify }}">{{ ct }}</h2>
<ul class="codinfox-category-list">
{% for post in site.posts %}
{% if post.categories contains ct %}
<li>
<a href="{{ post.url }}">
{{ post.title }}
</a>
<small>
</small>
</li>
{% endif %}
{% endfor %}
</ul>
{% endunless %}
{% endfor %}
<h2 id="no-category">No Category</h2>
<ul class="codinfox-category-list">
{% for post in site.posts %}
{% unless post.categories %}
<li>
<h3>
<a href="{{ post.url }}">
{{ post.title }}
</a>
<small>
</small>
</h3>
</li>
{% endunless %}
{% endfor %}
</ul>
</div>