-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblog.html
More file actions
202 lines (190 loc) · 5.12 KB
/
blog.html
File metadata and controls
202 lines (190 loc) · 5.12 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
---
layout: default
title: Blog
---
<section class="page-hero">
<div class="container">
<h1>Blog</h1>
<nav class="category-tabs">
<button class="tab-btn active" data-category="all">All</button>
{% assign sorted_posts = site.posts | sort: 'date' | reverse %}
{% assign cat_list = "" | split: "" %}
{% for p in sorted_posts %}
{% if p.type %}
{% assign cat = p.type %}
{% else %}
{% assign cat = "Uncategorized" %}
{% endif %}
{% assign already = false %}
{% for c in cat_list %}
{% if c == cat %}
{% assign already = true %}
{% endif %}
{% endfor %}
{% unless already %}
{% assign cat_list = cat_list | push: cat %}
{% endunless %}
{% endfor %}
{% assign cat_list = cat_list | sort %}
{% for cat in cat_list %}
<button class="tab-btn" data-category="{{ cat }}">{{ cat }}</button>
{% endfor %}
</nav>
</div>
</section>
<section class="posts-list">
<div class="container">
{% for cat in cat_list %}
<div class="category-group" data-category="{{ cat }}">
<div class="category-header">
<span class="category-prefix">//</span>
<span class="category-name">{{ cat }}</span>
</div>
{% for post in sorted_posts %}
{% if post.type %}
{% assign post_cat = post.type %}
{% else %}
{% assign post_cat = "Uncategorized" %}
{% endif %}
{% if post_cat == cat %}
<article class="post-item">
<div class="post-meta">{{ post.date | date: "%Y-%m-%d" }}</div>
<a href="{{ post.url }}" class="post-title">{{ post.title }}</a>
{% if post.excerpt %}
<p class="post-excerpt">{{ post.excerpt | strip_html | truncatewords: 30 }}</p>
{% endif %}
</article>
{% endif %}
{% endfor %}
</div>
{% endfor %}
{% if cat_list == empty %}
<div class="empty-state">
<p><no posts yet /></p>
</div>
{% endif %}
</div>
</section>
<style>
.page-hero {
padding: 48px 0 0;
border-bottom: 1px solid var(--border);
margin-bottom: 0;
}
.page-hero h1 {
font-size: 2.5rem;
font-weight: 800;
color: var(--text-primary);
margin-bottom: 24px;
}
.category-tabs {
display: flex;
gap: 8px;
flex-wrap: wrap;
padding-bottom: 24px;
}
.tab-btn {
font-family: 'IBM Plex Mono', monospace;
font-size: 0.85rem;
padding: 8px 16px;
background: transparent;
border: 1px solid var(--border);
color: var(--text-secondary);
cursor: pointer;
transition: all 0.2s;
}
.tab-btn:hover {
border-color: var(--amber);
color: var(--amber);
}
.tab-btn.active {
background: var(--amber);
border-color: var(--amber);
color: var(--bg-deep);
}
.posts-list {
padding-bottom: 100px;
}
.category-group {
display: block;
}
.category-group.hidden {
display: none;
}
.category-header {
font-family: 'IBM Plex Mono', monospace;
font-size: 0.9rem;
padding: 24px 0 16px;
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
gap: 8px;
}
.category-prefix {
color: var(--text-muted);
}
.category-name {
color: var(--amber);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
}
.post-item {
padding: 32px 0;
border-bottom: 1px solid var(--border);
}
.post-item:last-child {
border-bottom: none;
}
.post-meta {
font-family: 'IBM Plex Mono', monospace;
font-size: 0.8rem;
color: var(--syntax-green);
margin-bottom: 10px;
letter-spacing: 0.5px;
}
.post-title {
font-size: 1.35rem;
font-weight: 700;
color: var(--text-primary);
text-decoration: none;
display: block;
margin-bottom: 10px;
transition: color 0.2s;
line-height: 1.35;
}
.post-title:hover {
color: var(--amber);
}
.post-excerpt {
color: var(--text-secondary);
font-size: 0.95rem;
line-height: 1.7;
max-width: 600px;
}
.empty-state {
padding: 80px 0;
color: var(--text-muted);
text-align: left;
}
.empty-state p {
font-family: 'IBM Plex Mono', monospace;
font-size: 14px;
}
</style>
<script>
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
const cat = btn.dataset.category;
document.querySelectorAll('.category-group').forEach(group => {
if (cat === 'all' || group.dataset.category === cat) {
group.classList.remove('hidden');
} else {
group.classList.add('hidden');
}
});
});
});
</script>