Skip to content

Commit 57e0142

Browse files
committed
feat: Nicer Category/Tag index design
1 parent 081a555 commit 57e0142

2 files changed

Lines changed: 34 additions & 30 deletions

File tree

‎_includes/category.html‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{% assign category_posts = site.categories[page.category] | sort: "date" | reverse %}
22

3-
<p><a href="{{ '/blog/category/' | relative_url }}">All categories</a></p>
3+
<p><a href="{{ '/blog/category/' | relative_url }}">« All categories</a></p>
4+
5+
<p>{{ page.meta }}</p>
46

57
{% for post in category_posts %}
6-
{% assign current_year = post.date | date: "%Y" %}
7-
{% if current_year != category_year %}
8-
{% unless forloop.first %}</ol>{% endunless %}
9-
<hr>
10-
<h2>{{ current_year }}</h2>
11-
<ol reversed>
12-
{% assign category_year = current_year %}
13-
{% endif %}
14-
<li>
15-
<b><time datetime="{{ post.date | date: "%Y-%m-%d" }}">{{ post.date | date: "%B %d" }}</time></b>
16-
<br>
17-
<a href="{{ post.url | relative_url }}" style="view-transition-name: x-{{ post.date | date: '%Y-%m-%d' }}">{{ post.title }}</a>
18-
</li>
19-
{% if forloop.last %}</ol>{% endif %}
8+
{% assign current_year = post.date | date: "%Y" %}
9+
{% if current_year != category_year %}
10+
{% unless forloop.first %}</ol>{% endunless %}
11+
<hr>
12+
<h2>{{ current_year }}</h2>
13+
<ol reversed>
14+
{% assign category_year = current_year %}
15+
{% endif %}
16+
<li>
17+
<b><time datetime="{{ post.date | date: "%Y-%m-%d" }}">{{ post.date | date: "%B %d" }}</time></b>
18+
<br>
19+
<a href="{{ post.url | relative_url }}" style="view-transition-name: x-{{ post.date | date: '%Y-%m-%d' }}">{{ post.title }}</a>
20+
</li>
21+
{% if forloop.last %}</ol>{% endif %}
2022
{% endfor %}

‎_includes/tag.html‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{% assign tagged_posts = site.tags[page.tag] | sort: "date" | reverse %}
22

3-
<p><a href="{{ '/blog/tags/' | relative_url }}">All tags</a></p>
3+
<p><a href="{{ '/blog/tags/' | relative_url }}">« All tags</a></p>
4+
5+
<p>{{ page.meta }}</p>
46

57
{% for post in tagged_posts %}
6-
{% assign current_year = post.date | date: "%Y" %}
7-
{% if current_year != tag_year %}
8-
{% unless forloop.first %}</ol>{% endunless %}
9-
<hr>
10-
<h2>{{ current_year }}</h2>
11-
<ol reversed>
12-
{% assign tag_year = current_year %}
13-
{% endif %}
14-
<li>
15-
<b><time datetime="{{ post.date | date: "%Y-%m-%d" }}">{{ post.date | date: "%B %d" }}</time></b>
16-
<br>
17-
<a href="{{ post.url | relative_url }}" style="view-transition-name: x-{{ post.date | date: '%Y-%m-%d' }}">{{ post.title }}</a>
18-
</li>
19-
{% if forloop.last %}</ol>{% endif %}
8+
{% assign current_year = post.date | date: "%Y" %}
9+
{% if current_year != tag_year %}
10+
{% unless forloop.first %}</ol>{% endunless %}
11+
<hr>
12+
<h2>{{ current_year }}</h2>
13+
<ol reversed>
14+
{% assign tag_year = current_year %}
15+
{% endif %}
16+
<li>
17+
<b><time datetime="{{ post.date | date: "%Y-%m-%d" }}">{{ post.date | date: "%B %d" }}</time></b>
18+
<br>
19+
<a href="{{ post.url | relative_url }}" style="view-transition-name: x-{{ post.date | date: '%Y-%m-%d' }}">{{ post.title }}</a>
20+
</li>
21+
{% if forloop.last %}</ol>{% endif %}
2022
{% endfor %}

0 commit comments

Comments
 (0)