From ba1be9573ef20d6424ae987257a1c727c47d4b53 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Tue, 6 Oct 2026 20:46:31 +0300 Subject: Initial setup for website rewrite --- old_stuff/src/pages/blogs/[...slug].astro | 132 ++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 old_stuff/src/pages/blogs/[...slug].astro (limited to 'old_stuff/src/pages/blogs') diff --git a/old_stuff/src/pages/blogs/[...slug].astro b/old_stuff/src/pages/blogs/[...slug].astro new file mode 100644 index 0000000..a7394ca --- /dev/null +++ b/old_stuff/src/pages/blogs/[...slug].astro @@ -0,0 +1,132 @@ +--- +import { getCollection } from "astro:content"; +import Terminal from "@layouts/Terminal.astro"; +import BlogItem from "@components/BlogItem.astro"; +import Link from "@components/Link.astro"; +import TerminalBorder from "@components/TerminalBorder.astro"; + +export async function getStaticPaths() { + const blogEntries = await getCollection("blogs"); + return blogEntries.map((blog) => ({ + params: { slug: blog.slug }, + props: { entry: blog }, + })); +} + +const { entry } = Astro.props; +const { Content } = await entry.render(); + +const blogs = await getCollection("blogs"); +const sortedBlogs = blogs.sort((a, b) => +b.data.date - +a.data.date); +const currentIndex = sortedBlogs.findIndex((blog) => blog.slug === entry.slug); +const previousBlog = sortedBlogs[currentIndex + 1] || undefined; +const nextBlog = sortedBlogs[currentIndex - 1] || undefined; +--- + + +
+
+
+ +
+
+ +
+
+ { + previousBlog ? ( + + + + vim ~/blogs/{previousBlog.slug}.md + + + + ) : ( + +
+ + + + + -- cgit v1.3.1