mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
b3a1d9d369
Add trailing slash to links for improved consistency with RSS links and to avoid unnecessary redirects. --------- Co-authored-by: satnaing <satnaingdev@gmail.com>
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
---
|
|
import type { CollectionEntry } from "astro:content";
|
|
import Layout from "@layouts/Layout.astro";
|
|
import Main from "@layouts/Main.astro";
|
|
import Header from "@components/Header.astro";
|
|
import Footer from "@components/Footer.astro";
|
|
import Pagination from "@components/Pagination.astro";
|
|
import Card from "@components/Card";
|
|
import { SITE } from "@config";
|
|
|
|
export interface Props {
|
|
currentPage: number;
|
|
totalPages: number;
|
|
paginatedPosts: CollectionEntry<"blog">[];
|
|
}
|
|
|
|
const { currentPage, totalPages, paginatedPosts } = Astro.props;
|
|
---
|
|
|
|
<Layout title={`Posts | ${SITE.title}`}>
|
|
<Header activeNav="posts" />
|
|
<Main pageTitle="Posts" pageDesc="All the articles I've posted.">
|
|
<ul>
|
|
{
|
|
paginatedPosts.map(({ data, slug }) => (
|
|
<Card href={`/posts/${slug}/`} frontmatter={data} />
|
|
))
|
|
}
|
|
</ul>
|
|
</Main>
|
|
|
|
<Pagination
|
|
{currentPage}
|
|
{totalPages}
|
|
prevUrl={`/posts${currentPage - 1 !== 1 ? "/" + (currentPage - 1) : ""}/`}
|
|
nextUrl={`/posts/${currentPage + 1}/`}
|
|
/>
|
|
|
|
<Footer noMarginTop={totalPages > 1} />
|
|
</Layout>
|