aboutsummaryrefslogtreecommitdiff
path: root/src/pages/blog
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-09-12 19:36:57 +0300
committerValentin Popov <valentin@popov.link>2024-09-12 19:36:57 +0300
commit3376c53b2ee91041d5eaa0f9274da0affd7d4a9d (patch)
treea6b1e66a7e7f185128870b8f0ed671e2d7630f0e /src/pages/blog
parent0b57b888caf8817ff4992c59ed40ed29bee34fd4 (diff)
downloadpopov.link-3376c53b2ee91041d5eaa0f9274da0affd7d4a9d.tar.xz
popov.link-3376c53b2ee91041d5eaa0f9274da0affd7d4a9d.zip
Refactor Astro components and layouts
Diffstat (limited to 'src/pages/blog')
-rw-r--r--src/pages/blog/[...slug].astro19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro
index 9262a66..6754653 100644
--- a/src/pages/blog/[...slug].astro
+++ b/src/pages/blog/[...slug].astro
@@ -1,25 +1,20 @@
---
import { type CollectionEntry, getCollection } from "astro:content";
import Comments from "../../components/Comments.astro";
-import Layout from "../../layouts/PageLayout.astro";
-import Pagination from "../../components/PostPagination.astro";
+import Layout from "../../layouts/BaseLayout.astro";
export async function getStaticPaths() {
const posts = await getCollection("blog");
- const total = posts.length;
- return posts.map((post, index) => ({
+ return posts.map((post) => ({
params: { slug: post.slug },
- props: {
- post,
- prevPost: index + 1 === total ? null : posts[index + 1],
- nextPost: index === 0 ? null : posts[index - 1],
- },
+ props: post,
}));
}
+
type Props = CollectionEntry<"blog">;
-const { post, prevPost, nextPost } = Astro.props;
+const post = Astro.props;
const { Content, remarkPluginFrontmatter } = await post.render();
---
@@ -48,10 +43,6 @@ const { Content, remarkPluginFrontmatter } = await post.render();
</section>
<section>
- <Pagination prevPost={prevPost} nextPost={nextPost} />
- </section>
-
- <section>
<Comments />
</section>
</article>