From 80633f89aac47aca042b26c8475cd4d0f6244db0 Mon Sep 17 00:00:00 2001 From: fiatcode Date: Thu, 22 Jan 2026 15:20:41 +0700 Subject: [PATCH] refactor tag counting logic for clarity --- src/pages/tags/index.astro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/tags/index.astro b/src/pages/tags/index.astro index 54e75a7..9d41e27 100644 --- a/src/pages/tags/index.astro +++ b/src/pages/tags/index.astro @@ -6,7 +6,8 @@ const posts = await getCollection("blog"); const tagsMap = new Map(); posts.forEach((post) => { post.data.tags?.forEach((tag) => { - tagsMap.set(tag, (tagsMap.get(tag) || 0) + 1); + const currentCount = tagsMap.get(tag) || 0; + tagsMap.set(tag, currentCount + 1); }); }); const tags = Array.from(tagsMap.entries()).sort((a, b) =>