From 85d2ad60a20745cee297112672775201f4a1b7f9 Mon Sep 17 00:00:00 2001 From: webfussel Date: Mon, 18 Aug 2025 14:52:30 +0200 Subject: [PATCH] fix: filtering works now Fix wrong filtering --- app/pages/blog/index.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/pages/blog/index.vue b/app/pages/blog/index.vue index 2fa787f..c86a3dd 100644 --- a/app/pages/blog/index.vue +++ b/app/pages/blog/index.vue @@ -62,7 +62,14 @@ const externalPosts = computed(() => externalPostsRaw.value?.flatMap })) }) ?? []) -const allPosts = computed(() => [...(firstTen.value ?? []), ...(externalPosts.value ?? [])].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())) +const allPosts = computed(() => { + const allPosts = [...firstTen.value, ...externalPosts.value] + allPosts.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) + if (route.query.category && Object.keys(allCategoriesAndCount.value).includes(route.query.category as Category)) { + return allPosts.filter(article => article.category === route.query.category) + } + return allPosts +}) const allCategoriesAndCount = computed>(() => { const categories = {} as Record