添加博客索引页
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-03-27 17:25:01 +08:00
parent 4c5abe8b01
commit b6d60552e6
2 changed files with 23 additions and 1 deletions

22
src/pages/blogs.astro Normal file
View File

@ -0,0 +1,22 @@
---
import BaseLayout from '../layout/BaseLayout.astro'
import { listBlogs } from '../lib/apis/legacy/blog'
export const prerender = false
const _page = parseInt(Astro.url.searchParams.get('page') || '1')
const page = isNaN(_page) ? 1 : Math.max(1, _page)
const blogs = await listBlogs({ page })
---
<BaseLayout>
{
blogs.map((blog) => (
<div>
<a href={`/blogs/${blog.id}`}>{blog.title}</a>
</div>
))
}
</BaseLayout>

View File

@ -22,6 +22,6 @@ const tree = await toMarkdocTree(blogData.content)
--- ---
<!-- <BaseLayout set:html={blogRendered} /> --> <!-- <BaseLayout set:html={blogRendered} /> -->
<BaseLayout> <BaseLayout title={blogData.title}>
<MarkdocTreeRender tree={tree} client:load /> <MarkdocTreeRender tree={tree} client:load />
</BaseLayout> </BaseLayout>