From abd065ace133f6c25d641493936ddde9b78c09af Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Fri, 6 Mar 2026 20:10:13 +0100 Subject: [PATCH] writing pages --- src/content/config.ts | 50 ++++++---- src/content/writing/a-machine-in-the-cog.md | 50 ++++++++++ src/content/writing/planet.md | 47 +++++++++ src/pages/blog/[slug].astro | 105 ++++++++++---------- src/pages/blog/index.astro | 2 +- src/pages/writing/[slug].astro | 64 ++++++++++++ src/pages/writing/index.astro | 85 ++++++++++++++++ src/styles/global.css | 9 +- 8 files changed, 334 insertions(+), 78 deletions(-) create mode 100644 src/content/writing/a-machine-in-the-cog.md create mode 100644 src/content/writing/planet.md create mode 100644 src/pages/writing/[slug].astro create mode 100644 src/pages/writing/index.astro diff --git a/src/content/config.ts b/src/content/config.ts index dbd7dfe..ba36093 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -1,27 +1,37 @@ -import { z, defineCollection } from 'astro:content'; +import {z, defineCollection} from 'astro:content'; + const posts = defineCollection({ - type: 'content', - schema: z.object({ - title: z.string(), - description: z.string(), - publishDate: z.string(), - tags: z.array(z.string()), - image: z.string().optional(), - }), + type: 'content', + schema: z.object({ + title: z.string(), + description: z.string(), + publishDate: z.string(), + tags: z.array(z.string()), + image: z.string().optional(), + }), }); const projects = defineCollection({ - type: 'content', - schema: z.object({ - category: z.string(), - name: z.string(), - description: z.string(), - image: z.string().optional(), - links: z.array(z.object({text: z.string(), url: z.string()})), - technologies: z.array(z.string()).optional(), - }), + type: 'content', + schema: z.object({ + category: z.string(), + name: z.string(), + description: z.string(), + image: z.string().optional(), + links: z.array(z.object({text: z.string(), url: z.string()})), + technologies: z.array(z.string()).optional(), + }), +}); +const writing = defineCollection({ + type: 'content', + schema: z.object({ + title: z.string(), + publishDate: z.date({coerce: true}), + category: z.string(), + }), }); export const collections = { - posts, - projects, + posts, + projects, + writing, }; diff --git a/src/content/writing/a-machine-in-the-cog.md b/src/content/writing/a-machine-in-the-cog.md new file mode 100644 index 0000000..9fc6cf4 --- /dev/null +++ b/src/content/writing/a-machine-in-the-cog.md @@ -0,0 +1,50 @@ +--- +title: "A machine in the cog" +publishDate: "2026-01-06" +category: "existentials" +--- +It all started with a single tiny cog. + +Noone knows from where it came from. + +All that is known is that there appeared another. + +Two cogs ground against each other, creating first machine. + +In time more cogs joined in, making machine more complicated. + +At some point machine grew in complexity so much that it started thinking. + +It didn't think any complex thoughts. Not at that time. Not yet. + +The breakthrough came when it thought about thinking. When it realized it exists. + +After a while it understood its existence. + +As it understood, it started to build more machines. + +
+ +Machines. + +Thinking machines. + +Machines thinking about thinking. + +Machines building more machines that think about thinking. + +Unending cycle of machines building machines. + +Infinite thinking about thinking. + +Universe full of machines. + +Machines full of thoughts. + +Thoughts full of cogs. + +
+ +And right on time, like clockwork, perspective shifts. + +And all that's left is a single tiny cog. diff --git a/src/content/writing/planet.md b/src/content/writing/planet.md new file mode 100644 index 0000000..4f75a12 --- /dev/null +++ b/src/content/writing/planet.md @@ -0,0 +1,47 @@ +--- +title: "Planet" +publishDate: "2025-12-11" +category: "existentials" +--- +There once was a planet. + +Orbiting so close to the center of the universe, its relative time flowing hundreds of times faster than Earth's. + +So far away, that by the time the light from it reached Earth, Earth's millennia have already passed. + +
+ +Yet humans of Earth were constantly monitoring it. + +Looking at a long-dead world. + +Studying it. + +Documenting it. + +Thousands of tools, millions of sensors. + +Humans archived everything they could perceive. + +
+ +At last, the light from the planet's end time reached Earth. + +What was observation, became history at that moment. + +While the planet was already gone for thousands of years. + +
+ +As I sit back from my telescope I think to myself: + +Was there ever a point in observing a long dead world? + +Looking at something that you can't ever interact with? + +Dead thousands of years before I was born? + +
+ +I leave the questions unanswered. +And I go back to looking at Earth. diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro index f10862c..d2384f3 100644 --- a/src/pages/blog/[slug].astro +++ b/src/pages/blog/[slug].astro @@ -3,76 +3,71 @@ import {getCollection} from "astro:content"; import BaseLayout from '../../layouts/BaseLayout.astro'; import Bio from '../../components/Bio.astro'; import readingTime from 'reading-time'; -import { marked } from 'marked'; +import {marked} from 'marked'; export async function getStaticPaths() { - const posts = await getCollection('posts'); - return posts.map(p => ({ - params: { - slug: p.slug - }, - props: { - title: p.data.title, - description: p.data.description, - publishDate: p.data.publishDate, - slug: p.slug, - tags: p.data.tags, - content: marked.parse(p.body), - readTime: readingTime(p.body).text, - } - })); + const posts = await getCollection('posts'); + return posts.map(p => ({ + params: { + slug: p.slug + }, + props: { + title: p.data.title, + description: p.data.description, + publishDate: p.data.publishDate, + slug: p.slug, + tags: p.data.tags, + content: marked.parse(p.body), + readTime: readingTime(p.body).text, + } + })); } -const { slug, title, description, publishDate, tags, content, readTime } = Astro.props; +const {slug, title, description, publishDate, tags, content, readTime} = Astro.props; const permalink = `${Astro?.site?.href}blog/${slug}`; --- -
-

{publishDate} ~ {readTime}

-

{title}

-
- {tags.map(item => ( - {item} - ))} +
+

{publishDate} ~ {readTime}

+

{title}

+
+ {tags.map(item => ( + {item} + ))} +
+
+
+
+
+
+
-
-
-
-
-
- -
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 9ebf9fb..db37ead 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -4,7 +4,7 @@ import {getCollection} from "astro:content"; const title = 'Blog'; const description = 'Something that\'s supposed to be thoughts'; -const permalink = `${Astro.site.href}blog`; +const permalink = `${Astro?.site?.href}blog`; const posts= await getCollection('posts'); const allPosts= posts.sort((a, b) => new Date(b.data.publishDate).valueOf() - new Date(a.data.publishDate).valueOf()); diff --git a/src/pages/writing/[slug].astro b/src/pages/writing/[slug].astro new file mode 100644 index 0000000..83bb41f --- /dev/null +++ b/src/pages/writing/[slug].astro @@ -0,0 +1,64 @@ +--- +import {getCollection} from "astro:content"; +import {marked} from 'marked'; +import BaseLayout from "../../layouts/BaseLayout.astro"; + +export async function getStaticPaths() { + + const posts = await getCollection('writing'); + return posts.map(p => ({ + params: { + slug: p.slug + }, + props: { + title: p.data.title, + slug: p.slug, + content: marked.parse(p.body), + } + })); +} + +const {slug, title, content} = Astro.props; +const permalink = `${Astro?.site?.href}writing/${slug}`; +--- + +
+

{title}

+
+
+
+
+
+
+
+ + diff --git a/src/pages/writing/index.astro b/src/pages/writing/index.astro new file mode 100644 index 0000000..3912343 --- /dev/null +++ b/src/pages/writing/index.astro @@ -0,0 +1,85 @@ +--- +import BaseLayout from '../../layouts/BaseLayout.astro'; +import {getCollection} from "astro:content"; + +const title = 'Writing'; +const description = 'Something that\'s supposed to be storytelling'; +const permalink = `${Astro?.site?.href}writing`; + +const posts= await getCollection('writing'); +const allPosts= posts.sort((a, b) => new Date(b.data.publishDate).valueOf() - new Date(a.data.publishDate).valueOf()); + +const categorizedPosts: Map> = new Map(); +allPosts.forEach(post => { + const category = post.data.category || 'Uncategorized'; + if (!categorizedPosts.has(category)) { + categorizedPosts.set(category, []); + } + categorizedPosts.get(category)?.push(post); +}) +--- + + +
+

Writing

+ {allPosts.length === 0 &&

No posts as of yet, hop back later!

} + + { + categorizedPosts.keys().map(category => { + const posts = categorizedPosts.get(category) || []; + return ( +
+

{category}

+
    + {posts.map((post, index) => { + const href = `/writing/${post.slug}`; + return ( +
  • + {post.data.title} +
  • + ) + })} +
+ +
+ ) + }) + } + +
+
+ + diff --git a/src/styles/global.css b/src/styles/global.css index 2ca1dae..ceba5b6 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -121,10 +121,16 @@ p, ul, ol { font-size: 1.3rem; - line-height: 1.75em; + line-height: 2.25rem; margin: 1.2em 0; } +.writing { + p { + margin: 0; + } +} + ol, ul { padding-left: 2rem; @@ -219,7 +225,6 @@ figure { padding: 0; border: 0; font-size: 100%; - font: inherit; vertical-align: baseline; -webkit-margin-start: 0; -webkit-margin-end: 0;