From bc703961cc4f2e8b0938488c2dc2bf09e721fa54 Mon Sep 17 00:00:00 2001 From: Bjorn Beishline <75190918+BjornTheProgrammer@users.noreply.github.com> Date: Thu, 5 Feb 2026 22:20:59 -0700 Subject: [PATCH] Get blog pages working --- app/components/BlogList.vue | 2 +- app/components/TitleSection.vue | 5 +++++ app/pages/blog/[...slug].vue | 20 +++++++++++++++++++- content.config.ts | 13 +++++++++---- content/blog/2026-02-06.md | 7 ++++--- content/blog/2026-02-07.md | 7 ++++--- content/blog/index.md | 4 +++- 7 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 app/components/TitleSection.vue diff --git a/app/components/BlogList.vue b/app/components/BlogList.vue index 989922c..021d5f8 100644 --- a/app/components/BlogList.vue +++ b/app/components/BlogList.vue @@ -20,7 +20,7 @@ const { data: posts } = await useAsyncData("blog-posts", () => {

{{ post.title }}

{{ post.description }}

- {{ post.author }} + {{ post.author.name }} • {{ new Date(post.date).toLocaleDateString(undefined, { diff --git a/app/components/TitleSection.vue b/app/components/TitleSection.vue new file mode 100644 index 0000000..710a6dc --- /dev/null +++ b/app/components/TitleSection.vue @@ -0,0 +1,5 @@ + + + diff --git a/app/pages/blog/[...slug].vue b/app/pages/blog/[...slug].vue index b8f898e..31372cd 100644 --- a/app/pages/blog/[...slug].vue +++ b/app/pages/blog/[...slug].vue @@ -18,7 +18,25 @@ if (!page.value) {
- +

+ {{ page.title }} +

+
+ {{ + page.author.name + }} + • + {{ + new Date(page.date).toLocaleDateString(undefined, { + year: "numeric", + month: "long", + day: "numeric", + }) + }} +
+ + Hello +
diff --git a/content.config.ts b/content.config.ts index 557a0e0..a940387 100644 --- a/content.config.ts +++ b/content.config.ts @@ -1,4 +1,4 @@ -import { defineContentConfig, defineCollection } from "@nuxt/content"; +import { defineContentConfig, defineCollection, property } from "@nuxt/content"; import { z } from "zod"; export default defineContentConfig({ @@ -6,11 +6,16 @@ export default defineContentConfig({ blog: defineCollection({ type: "page", source: "blog/*.md", - // Define custom schema for docs collection schema: z.object({ - tags: z.array(z.string()), + hero: property(z.object({})).inherit( + "app/components/TitleSection.vue", + ), date: z.date(), - author: z.string(), + author: z.object({ + name: z.string(), + url: z.string().url(), + }), + title: z.string(), }), }), }, diff --git a/content/blog/2026-02-06.md b/content/blog/2026-02-06.md index 9b7a0ed..95e8242 100644 --- a/content/blog/2026-02-06.md +++ b/content/blog/2026-02-06.md @@ -1,10 +1,11 @@ --- date: 2026-02-06 -author: [BjornTheProgrammer](https://github.com/BjornTheProgrammer) +author: + name: BjornTheProgrammer + url: https://github.com/BjornTheProgrammer +title: Pumpkin Week 1 Updates --- -# Pumpkin Week 1 Updates - Some updates occured this week. diff --git a/content/blog/2026-02-07.md b/content/blog/2026-02-07.md index 20ec428..eb4bd04 100644 --- a/content/blog/2026-02-07.md +++ b/content/blog/2026-02-07.md @@ -1,10 +1,11 @@ --- date: 2026-02-07 -author: [BjornTheProgrammer](https://github.com/BjornTheProgrammer) +author: + name: BjornTheProgrammer + url: https://github.com/BjornTheProgrammer +title: Pumpkin Week 2 Updates --- -# Pumpkin Week 2 Updates - Some updates occured this week. diff --git a/content/blog/index.md b/content/blog/index.md index 946c1b4..39f5ea8 100644 --- a/content/blog/index.md +++ b/content/blog/index.md @@ -1,4 +1,6 @@ -# Blog +--- +title: Blog +--- ::BlogList ::