文章页优化
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
---
|
||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||
import Pagination from '@/components/Pagination.astro';
|
||||
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
||||
import { getAllPosts } from '@/lib/posts';
|
||||
import { getPageSlice } from '@/lib/pagination';
|
||||
|
||||
const posts = getAllPosts();
|
||||
const pageData = getPageSlice(posts, 1);
|
||||
---
|
||||
|
||||
<BaseLayout title="归档">
|
||||
<section class="content-wrap narrow">
|
||||
<PageHeaderCard title="归档" subtitle={`共 ${posts.length} 篇文章`} />
|
||||
<div class="archive-list">
|
||||
{posts.map((post) => (
|
||||
{pageData.items.map((post) => (
|
||||
<a href={post.href}>
|
||||
<time datetime={post.date.toISOString()}>{post.dateText}</time>
|
||||
<span>{post.title}</span>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
<Pagination currentPage={pageData.currentPage} totalPages={pageData.totalPages} basePath="/archives/" />
|
||||
</section>
|
||||
</BaseLayout>
|
||||
|
||||
Reference in New Issue
Block a user