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:
Sat Naing
2024-09-16 20:43:54 +07:00
committed by GitHub
parent 08b1676cdd
commit 29eff36794
2 changed files with 106 additions and 15 deletions
+5 -1
View File
@@ -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} />