Skip to content

Commit 2125376

Browse files
다국어 아카이브 페이지에서 현재 언어에 맞는 포스트만 필터링하여 표시하도록 수정했습니다. 한국어, 영어, 일본어 아카이브 페이지에서 각각의 언어에 해당하는 포스트 수를 정확히 반영하도록 개선하였습니다.
1 parent 1d7f21d commit 2125376

File tree

3 files changed

+52
-56
lines changed

3 files changed

+52
-56
lines changed

archive.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,41 @@ permalink: /archive/
99
{% assign posts_by_year = site.posts | group_by_exp: "post", "post.date | date: '%Y'" %}
1010

1111
{% for year in posts_by_year %}
12-
<div class="archive-year">
13-
<h2 class="year-title">{{ year.name }}년</h2>
14-
<div class="year-stats">{{ year.items | size }}개 포스트</div>
15-
16-
<div class="posts-list">
17-
{% for post in year.items %}
18-
<article class="archive-post">
19-
<div class="post-date">
20-
{{ post.date | date: "%m.%d" }}
21-
</div>
22-
<div class="post-info">
23-
<h3 class="post-title">
24-
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
25-
</h3>
26-
{% if post.excerpt %}
27-
<p class="post-excerpt">{{ post.excerpt | strip_html | truncate: 120 }}</p>
28-
{% endif %}
29-
{% if post.tags %}
30-
<div class="post-tags">
31-
{% for tag in post.tags limit: 3 %}
32-
<span class="tag">{{ tag }}</span>
33-
{% endfor %}
34-
</div>
35-
{% endif %}
36-
</div>
37-
</article>
38-
{% endfor %}
12+
{% comment %} 현재 언어의 포스트만 필터링 {% endcomment %}
13+
{% assign current_lang = page.lang | default: site.default_lang %}
14+
{% assign korean_posts = year.items | where_exp: "item", "item.lang == nil or item.lang == current_lang" %}
15+
16+
{% if korean_posts.size > 0 %}
17+
<div class="archive-year">
18+
<h2 class="year-title">{{ year.name }}년</h2>
19+
<div class="year-stats">{{ korean_posts | size }}개 포스트</div>
20+
21+
<div class="posts-list">
22+
{% for post in korean_posts %}
23+
<article class="archive-post">
24+
<div class="post-date">
25+
{{ post.date | date: "%m.%d" }}
26+
</div>
27+
<div class="post-info">
28+
<h3 class="post-title">
29+
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
30+
</h3>
31+
{% if post.excerpt %}
32+
<p class="post-excerpt">{{ post.excerpt | strip_html | truncate: 120 }}</p>
33+
{% endif %}
34+
{% if post.tags %}
35+
<div class="post-tags">
36+
{% for tag in post.tags limit: 3 %}
37+
<span class="tag">{{ tag }}</span>
38+
{% endfor %}
39+
</div>
40+
{% endif %}
41+
</div>
42+
</article>
43+
{% endfor %}
44+
</div>
3945
</div>
40-
</div>
46+
{% endif %}
4147
{% endfor %}
4248
</div>
4349

en/archive.html

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
{% assign posts_by_year = site.posts | group_by_exp: "post", "post.date | date: '%Y'" %}
1010

1111
{% for year in posts_by_year %}
12-
<div class="archive-year">
13-
<h2 class="year-title">{{ year.name }}</h2>
14-
<div class="year-stats">{{ year.items | size }} posts</div>
15-
16-
<div class="posts-list">
17-
{% assign english_posts = year.items | where: "lang", "en" %}
18-
{% if english_posts.size > 0 %}
12+
{% assign english_posts = year.items | where: "lang", "en" %}
13+
{% if english_posts.size > 0 %}
14+
<div class="archive-year">
15+
<h2 class="year-title">{{ year.name }}</h2>
16+
<div class="year-stats">{{ english_posts | size }} posts</div>
17+
18+
<div class="posts-list">
1919
{% for post in english_posts %}
2020
<article class="archive-post">
2121
<div class="post-date">
@@ -38,14 +38,9 @@ <h3 class="post-title">
3838
</div>
3939
</article>
4040
{% endfor %}
41-
{% else %}
42-
<div class="no-posts-message">
43-
<p>No English posts are available yet. Posts will be added soon!</p>
44-
<p>Currently, all posts are available in <a href="{{ '/' | relative_url }}">Korean</a>.</p>
45-
</div>
46-
{% endif %}
41+
</div>
4742
</div>
48-
</div>
43+
{% endif %}
4944
{% endfor %}
5045
</div>
5146

ja/archive.html

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
{% assign posts_by_year = site.posts | group_by_exp: "post", "post.date | date: '%Y'" %}
1010

1111
{% for year in posts_by_year %}
12-
<div class="archive-year">
13-
<h2 class="year-title">{{ year.name }}年</h2>
14-
<div class="year-stats">{{ year.items | size }}件の記事</div>
15-
16-
<div class="posts-list">
17-
{% assign japanese_posts = year.items | where: "lang", "ja" %}
18-
{% if japanese_posts.size > 0 %}
12+
{% assign japanese_posts = year.items | where: "lang", "ja" %}
13+
{% if japanese_posts.size > 0 %}
14+
<div class="archive-year">
15+
<h2 class="year-title">{{ year.name }}年</h2>
16+
<div class="year-stats">{{ japanese_posts | size }}件の記事</div>
17+
18+
<div class="posts-list">
1919
{% for post in japanese_posts %}
2020
<article class="archive-post">
2121
<div class="post-date">
@@ -38,14 +38,9 @@ <h3 class="post-title">
3838
</div>
3939
</article>
4040
{% endfor %}
41-
{% else %}
42-
<div class="no-posts-message">
43-
<p>まだ日本語の記事はありません。近日中に追加予定です!</p>
44-
<p>現在、すべての記事は<a href="{{ '/' | relative_url }}">韓国語</a>でご利用いただけます。</p>
45-
</div>
46-
{% endif %}
41+
</div>
4742
</div>
48-
</div>
43+
{% endif %}
4944
{% endfor %}
5045
</div>
5146

0 commit comments

Comments
 (0)