From 62b78058a5dd7bdd00fa332557c72f29c30dfae1 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Wed, 18 Feb 2026 15:58:37 +0000 Subject: [PATCH 1/3] feat(blog): added blog posting infrastructure --- src/content.config.ts | 15 +++++++++++++++ src/layouts/MainLayout.astro | 19 ++++++++++++++++++- src/layouts/Panel.astro | 4 ++-- src/pages/blog/[...slug].astro | 33 +++++++++++++++++++++++++++++++++ src/pages/blog/index.astro | 31 +++++++++++++++++++++++++++++++ src/pages/blog/index.scss | 8 ++++++++ 6 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 src/content.config.ts create mode 100644 src/pages/blog/[...slug].astro create mode 100644 src/pages/blog/index.astro create mode 100644 src/pages/blog/index.scss diff --git a/src/content.config.ts b/src/content.config.ts new file mode 100644 index 0000000..6e97e59 --- /dev/null +++ b/src/content.config.ts @@ -0,0 +1,15 @@ +import { defineCollection, z } from "astro:content"; +import { glob } from "astro/loaders"; + +const blog = defineCollection({ + loader: glob({ base: "./src/content/posts", pattern: "**/*.{md,mdx}" }), + schema: z.object({ + title: z.string(), + description: z.string().optional(), + pubDate: z.coerce.date(), + modifiedDate: z.coerce.date().optional(), + wantsPanel: z.boolean().default(true) + }) +}); + +export const collections = { blog }; \ No newline at end of file diff --git a/src/layouts/MainLayout.astro b/src/layouts/MainLayout.astro index 3471e98..51b3fc2 100644 --- a/src/layouts/MainLayout.astro +++ b/src/layouts/MainLayout.astro @@ -1,5 +1,12 @@ --- +import Panel from "./Panel.astro"; import "../styles/global.scss"; +import { getCollection } from "astro:content"; + +const { title } = Astro.props; +const pageTitle = title || "FoxGirlRiley's shitty website | Bwaaa 🎺"; + +const hasPosts = (await getCollection("blog")).length > 0; --- @@ -8,9 +15,19 @@ import "../styles/global.scss"; - FoxGirlRiley's shitty website | Bwaaa 🎺 + {pageTitle} + { + hasPosts && ( + + + Home + Blog + + + ) + } diff --git a/src/layouts/Panel.astro b/src/layouts/Panel.astro index ee904d2..6ca9123 100644 --- a/src/layouts/Panel.astro +++ b/src/layouts/Panel.astro @@ -1,9 +1,9 @@ --- import "../styles/Panel.scss"; -const { title } = Astro.props; +const { title, customClass } = Astro.props; --- -
+
{title &&

{title}

}
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro new file mode 100644 index 0000000..6d201a1 --- /dev/null +++ b/src/pages/blog/[...slug].astro @@ -0,0 +1,33 @@ +--- +import { render } from "astro:content"; +import { getCollection } from "astro:content"; +import Main from "../../layouts/MainLayout.astro"; +import TransFlagPanel from "../../layouts/TransFlagPanel.astro"; +import Panel from "../../layouts/Panel.astro"; + +export const getStaticPaths = async () => { + const posts = await getCollection("blog"); + return posts.map((post) => ({ + params: { slug: post.id }, + props: post, + })); +}; + +const post = Astro.props; +const { Content } = await render(post); +--- + +
+ +

{post.data.title}

+
+ { + post.data.wantsPanel ? ( + + + + ) : ( + + ) + } +
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro new file mode 100644 index 0000000..17229f1 --- /dev/null +++ b/src/pages/blog/index.astro @@ -0,0 +1,31 @@ +--- +import { getCollection } from "astro:content"; +import Main from "../../layouts/MainLayout.astro"; +import TransFlagPanel from "../../layouts/TransFlagPanel.astro"; +import Panel from "../../layouts/Panel.astro"; +import "./index.scss"; + +const latestPosts = (await getCollection("blog")).sort( + (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), +); +--- + +
+ +

Blog!!!

+
+ { + latestPosts.map((post) => { + return ( + + +

{post.data.description}

+
+
+ ); + }) + } +
diff --git a/src/pages/blog/index.scss b/src/pages/blog/index.scss new file mode 100644 index 0000000..3bba555 --- /dev/null +++ b/src/pages/blog/index.scss @@ -0,0 +1,8 @@ +.blog-post-panel { + background-color: lightgray; +} + +.blog-post-link { + text-decoration: none; + color: black; +} \ No newline at end of file From 467a17d1227ba5b339cddf6429532895068f0477 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Wed, 18 Feb 2026 16:02:34 +0000 Subject: [PATCH 2/3] feat(blog): added example blog post files --- src/content/posts/post.md.example | 8 ++++++++ src/content/posts/post.mdx.example | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/content/posts/post.md.example create mode 100644 src/content/posts/post.mdx.example diff --git a/src/content/posts/post.md.example b/src/content/posts/post.md.example new file mode 100644 index 0000000..f1006f4 --- /dev/null +++ b/src/content/posts/post.md.example @@ -0,0 +1,8 @@ +--- +title: "bwa" +pubDate: "18 Feb 2026 10:30" +--- + +Test Poast + +# bwaaaa \ No newline at end of file diff --git a/src/content/posts/post.mdx.example b/src/content/posts/post.mdx.example new file mode 100644 index 0000000..b2fd1b1 --- /dev/null +++ b/src/content/posts/post.mdx.example @@ -0,0 +1,17 @@ +--- +title: "bwaaa" +description: "This is a test description" +pubDate: "18 Feb 2026 12:00" +wantsPanel: false +--- + +import Panel from "../../layouts/Panel.astro"; + + +# bwaaaa +poast + + +# bwaaaaa +multi-panel poast!!! + \ No newline at end of file From d1629897607ff667ad96b6bb23fa3c6d05e40585 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Wed, 18 Feb 2026 21:08:07 +0000 Subject: [PATCH 3/3] feat(blog): added first blog post --- src/content/posts/myExperiencesWithAstro.md | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/content/posts/myExperiencesWithAstro.md diff --git a/src/content/posts/myExperiencesWithAstro.md b/src/content/posts/myExperiencesWithAstro.md new file mode 100644 index 0000000..82488fa --- /dev/null +++ b/src/content/posts/myExperiencesWithAstro.md @@ -0,0 +1,27 @@ +--- +title: "My experiences with Astro" +description: "" +pubDate: "18 Feb 2026 21:07" +--- + + + + # What is Astro? +Astro is a static site generator that allows you to combine components together to quickly put together a website. It's somewhat similar to something like React, but instead of having the bloat of all the javascript it generates, Astro outputs a static HTML website. The only javascript it includes is what you write in `