fix
This commit is contained in:
27
src/pages/posts/index.astro
Normal file
27
src/pages/posts/index.astro
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
import PostCard from '../../components/PostCard.astro';
|
||||
import Pagination from '../../components/Pagination.astro';
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import { getApprovedPosts, getPaginatedPosts, readCms } from '../../lib/cms';
|
||||
|
||||
const cms = await readCms();
|
||||
const pageParam = Number(Astro.url.searchParams.get('page') ?? '1');
|
||||
const requestedPage = Number.isFinite(pageParam) ? pageParam : 1;
|
||||
const { currentPage, totalPages, posts } = getPaginatedPosts(requestedPage, 4, getApprovedPosts(cms));
|
||||
---
|
||||
|
||||
<BaseLayout title="همه اخبار | روس امروز">
|
||||
<main class="max-w-7xl mx-auto px-4 lg:px-8 py-8">
|
||||
<div class="mb-6">
|
||||
<span class="text-brand text-sm font-bold">آرشیو</span>
|
||||
<h1 class="text-2xl font-black mt-1">همه اخبار</h1>
|
||||
<p class="text-gray-500 text-sm mt-2">لیست کامل نوشتهها و خبرهای منتشر شده در روس امروز</p>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
{posts.map((post) => <PostCard post={post} />)}
|
||||
</div>
|
||||
|
||||
<Pagination currentPage={currentPage} totalPages={totalPages} />
|
||||
</main>
|
||||
</BaseLayout>
|
||||
Reference in New Issue
Block a user