This commit is contained in:
22
src/pages/blogs.astro
Normal file
22
src/pages/blogs.astro
Normal 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>
|
||||
@ -22,6 +22,6 @@ const tree = await toMarkdocTree(blogData.content)
|
||||
---
|
||||
|
||||
<!-- <BaseLayout set:html={blogRendered} /> -->
|
||||
<BaseLayout>
|
||||
<BaseLayout title={blogData.title}>
|
||||
<MarkdocTreeRender tree={tree} client:load />
|
||||
</BaseLayout>
|
||||
|
||||
Reference in New Issue
Block a user