-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathposts.html
More file actions
173 lines (160 loc) · 7.52 KB
/
posts.html
File metadata and controls
173 lines (160 loc) · 7.52 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
layout: default
title: Posts
---
<h1 class = "post-title">{{ page.title }}</h1>
<div class = "w-80 mx-auto">
{% assign all_posts = site.categories["Pinned"]
| sort: "date", "first" | reverse %}
{% assign sorted_posts = "" | split: "," %}
{% assign sorted_modified = "" | split: "," %}
{% for post in all_posts %}
{% if post.last_modified %}
{% assign testDate = site.time
| date: "%s" %}
{% assign cutoff = testDate
| minus: 2592000 %}
{% assign testPost = post.last_modified
| date: "%s" | minus: 0 %}
{% if testPost >= cutoff %}
{% assign sorted_modified = sorted_modified
| push: post %}
{% else %}
{% assign sorted_posts = sorted_posts
| push: post %}
{% endif %}
{% else %}
{% assign sorted_posts = sorted_posts
| push: post %}
{% endif %}
{% endfor %}
{% assign sorted_modified = sorted_modified
| sort: "last_modified", "first" | reverse %}
{% if sorted_posts.size > 0 or sorted_modified.size > 0 %}
<div class = "d-flex flex-column border rounded px-4 py-3 mt-4">
<h3>Pinned</h3>
{% for post in sorted_modified %}
{% if post.url %}
<a class = "my-2" href = "{{ post.url }}"><span><span class = "badge bg-gradient mr-1">{{ post.last_modified | date_to_string: "ordinal", "US" }}</span><span class = "badge bg-danger mr-1">Pinned</span><span class = "badge bg-primary mr-2">Updated</span>{{ post.title }}</span></a>
{% endif %}
{% endfor %}
{% for post in sorted_posts %}
{% if post.url %}
<a class = "my-2" href = "{{ post.url }}"><span><span class = "badge bg-gradient mr-1">{{ post.date | date_to_string: "ordinal", "US" }}</span><span class = "badge bg-danger mr-2">Pinned</span>{{ post.title }}</span></a>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% assign all_posts = site.categories["Resources"]
| sort: "date", "first" | reverse %}
{% assign sorted_posts = "" | split: "," %}
{% assign sorted_modified = "" | split: "," %}
{% for post in all_posts %}
{% if post.last_modified %}
{% assign testDate = site.time
| date: "%s" %}
{% assign cutoff = testDate
| minus: 2592000 %}
{% assign testPost = post.last_modified
| date: "%s" | minus: 0 %}
{% if testPost >= cutoff %}
{% assign sorted_modified = sorted_modified
| push: post %}
{% else %}
{% assign sorted_posts = sorted_posts
| push: post %}
{% endif %}
{% else %}
{% assign sorted_posts = sorted_posts
| push: post %}
{% endif %}
{% endfor %}
{% assign sorted_modified = sorted_modified
| sort: "last_modified", "first" | reverse %}
{% if sorted_posts.size > 0 or sorted_modified.size > 0 %}
<div class = "d-flex flex-column border rounded px-4 py-3 mt-4">
<h3>Resources</h3>
{% for post in sorted_modified %}
{% if post.url %}
<a class = "my-2" href = "{{ post.url }}"><span><span class = "badge bg-gradient mr-1">{{ post.last_modified | date_to_string: "ordinal", "US" }}</span><span class = "badge bg-danger mr-1">Pinned</span><span class = "badge bg-primary mr-2">Updated</span>{{ post.title }}</span></a>
{% endif %}
{% endfor %}
{% for post in sorted_posts %}
{% if post.url %}
<a class = "my-2" href = "{{ post.url }}"><span><span class = "badge bg-gradient mr-1">{{ post.date | date_to_string: "ordinal", "US" }}</span>{{ post.title }}</span></a>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% comment %}
Alphabetize categories before displaying them
{% endcomment %}
{% assign cats = "" | split: "," %}
{% for category in site.categories %}
{% assign name = category | first %}
{% assign cats = cats | push: name %}
{% endfor %}
{% assign cats = cats | sort %}
{% for category in cats %}
{% assign name = category %}
{% if name != "Pinned" and name != "Resources" %}
{% assign all_posts = site.categories[name]
| sort: "date", "first" | reverse %}
{% assign sorted_posts = "" | split: "," %}
{% assign sorted_modified = "" | split: "," %}
{% for post in all_posts %}
{% if post.last_modified %}
{% assign testDate = site.time
| date: "%s" %}
{% assign cutoff = testDate
| minus: 2592000 %}
{% assign testPost = post.last_modified
| date: "%s" | minus: 0 %}
{% if testPost >= cutoff %}
{% assign sorted_modified = sorted_modified
| push: post %}
{% else %}
{% assign sorted_posts = sorted_posts
| push: post %}
{% endif %}
{% else %}
{% assign sorted_posts = sorted_posts
| push: post %}
{% endif %}
{% endfor %}
{% assign sorted_modified = sorted_modified
| sort: "last_modified", "first" | reverse %}
{% if sorted_posts.size > 0 or sorted_modified.size > 0 %}
<div class = "d-flex flex-column border rounded px-4 py-3 mt-4">
<h3>{{ name }}</h3>
{% for post in sorted_modified %}
{% if post.url %}
{% assign pinned = false %}
{% for c in post.categories %}
{% if c == "Pinned" %}
{% assign pinned = true %}
{% endif %}
{% endfor %}
{% unless pinned %}
<a class = "my-2" href = "{{ post.url }}"><span><span class = "badge bg-gradient mr-1">{{ post.last_modified | date_to_string: "ordinal", "US" }}</span><span class = "badge bg-primary ml-1 mr-2">Updated</span>{{ post.title }}</span></a>
{% endunless %}
{% endif %}
{% endfor %}
{% for post in sorted_posts %}
{% if post.url %}
{% assign pinned = false %}
{% for c in post.categories %}
{% if c == "Pinned" %}
{% assign pinned = true %}
{% endif %}
{% endfor %}
{% unless pinned %}
<a class = "my-2" href = "{{ post.url }}"><span><span class = "badge bg-gradient mr-2">{{ post.date | date_to_string: "ordinal", "US" }}</span>{{ post.title }}</span></a>
{% endunless %}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endfor %}
</div>