From abbe9f653114a1a717550138b3a050344afcba9c Mon Sep 17 00:00:00 2001 From: log101 Date: Tue, 16 Sep 2025 05:45:57 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20kategori=20sayfalar=C4=B1n=C4=B1=20ekle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/[category]/[page]/index.astro | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/pages/[category]/[page]/index.astro b/src/pages/[category]/[page]/index.astro index 7ce4af7..b013a12 100644 --- a/src/pages/[category]/[page]/index.astro +++ b/src/pages/[category]/[page]/index.astro @@ -1,7 +1,6 @@ --- import type { Page } from "astro"; import { getCollection } from "astro:content"; -import { CATEGORIES } from "@/content/config"; import Header from "@/components/Header.astro"; import Footer from "@/components/Footer.astro"; @@ -9,19 +8,16 @@ import Layout from "@/layouts/Layout.astro"; import Post from "@/components/Post.astro"; export async function getStaticPaths({ paginate }: { paginate: any }) { - const blogEntries = await getCollection("blog"); - const allReviews = await getCollection("bookReview"); + const posts = await getCollection("posts"); + const categories = await getCollection("categories"); - const allPosts = [...allReviews, ...blogEntries].filter( - (post) => !post.data.draft - ); - - return CATEGORIES.flatMap((category) => { - const filteredPosts = allPosts.filter( - (post) => post.data.category == category + return categories.flatMap((category) => { + const filteredPosts = posts.filter((post) => + post.data.categories.find((c) => c.id === category.id) ); + return paginate(filteredPosts, { - params: { category }, + params: { category: category.data.slug }, pageSize: 3, }); });