Skip to content

Commit 6e19339

Browse files
committed
Make posts category info separate, archive more automatic.
Inspired by: https://ginopalazzo.github.io/web/jekyll-color-code-categories.html
1 parent f87e1bb commit 6e19339

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ exclude:
6666
- README.md
6767
- CNAME
6868

69+
collections:
70+
- posts_category_info

_includes/archive-category.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
{% comment %} Assumes `category_info` variable containing `.name` and `.description`. {% endcomment %}
12
<div class="archive-group">
2-
<div id="#{{ category_name | slugize }}"></div>
3+
<div id="#{{ category_info.name | slugize }}"></div>
34
<p></p>
4-
<h2 class="category-head">{{ category_name | capitalize }}</h2>
5-
<a name="{{ category_name | slugize }}"></a>
6-
{{category_desc}}
5+
<h2 class="category-head">{{ category_info.name | capitalize }}</h2>
6+
<a name="{{ category_info.name | slugize }}"></a>
7+
{{category_info.description}}
78
{% capture curr_date %}first-entry{% endcapture %}
89
<div class="group-year">
910
<ul>
10-
{% for post in site.categories[category_name] %}
11+
{% for post in site.categories[category_info.name] %}
1112
{% capture post_date %}{{ post.date | date: "%b, %Y" }}{% endcapture %}
1213
{% unless curr_date == post_date %}
1314
{% unless curr_date == "first-entry" %}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
name: papers
3+
description: "Notes written down while reading and trying to understand random ML/SWE/CS papers. Originally not intended for the eyes of other people and therefore possibly incomprehensible and/or flat out wrong."
4+
---

_posts_category_info/02_misc.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
name: misc
3+
description: "Various random content I thought might be interesting."
4+
---

archive.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
---
66

77
<div id="archives">
8-
{% capture category_name %}papers{% endcapture %}
9-
{% capture category_desc %}Notes written down while reading and trying to understand random ML/SWE/CS papers. Originally not intended for the eyes of other people and therefore possibly incomprehensible and/or flat out wrong. {% endcapture %}
10-
{% include archive-category.html %}
11-
12-
{% capture category_name %}misc{% endcapture %}
13-
{% capture category_desc %}Various random content I thought might be interesting. {% endcapture %}
14-
{% include archive-category.html %}
8+
{% for category_info in site.posts_category_info %}
9+
{% include archive-category.html %}
10+
{% endfor %}
1511
</div>

0 commit comments

Comments
 (0)