mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 19:41:02 +08:00
feat: add prev/next links at the bottom of blog post (#372)
* feat: add prev/next links at the bottom of blog post * fix: update and rerun scripts in post details page after swap Resolves #358
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
---
|
||||
import { type CollectionEntry, getCollection } from "astro:content";
|
||||
import PostDetails from "@layouts/PostDetails.astro";
|
||||
import getSortedPosts from "@utils/getSortedPosts";
|
||||
|
||||
export interface Props {
|
||||
post: CollectionEntry<"blog">;
|
||||
@@ -18,6 +19,9 @@ export async function getStaticPaths() {
|
||||
}
|
||||
|
||||
const { post } = Astro.props;
|
||||
|
||||
const posts = await getCollection("blog");
|
||||
const sortedPosts = getSortedPosts(posts);
|
||||
---
|
||||
|
||||
<PostDetails post={post} />
|
||||
<PostDetails post={post} posts={sortedPosts} />
|
||||
|
||||
Reference in New Issue
Block a user