Get blog pages working
This commit is contained in:
parent
ab06eb5902
commit
bc703961cc
@ -20,7 +20,7 @@ const { data: posts } = await useAsyncData("blog-posts", () => {
|
|||||||
<h2 class="mt-2">{{ post.title }}</h2>
|
<h2 class="mt-2">{{ post.title }}</h2>
|
||||||
<p>{{ post.description }}</p>
|
<p>{{ post.description }}</p>
|
||||||
<div class="opacity-60 mb-5">
|
<div class="opacity-60 mb-5">
|
||||||
<span>{{ post.author }}</span>
|
<span>{{ post.author.name }}</span>
|
||||||
<span class="mx-2">•</span>
|
<span class="mx-2">•</span>
|
||||||
<span>{{
|
<span>{{
|
||||||
new Date(post.date).toLocaleDateString(undefined, {
|
new Date(post.date).toLocaleDateString(undefined, {
|
||||||
|
|||||||
5
app/components/TitleSection.vue
Normal file
5
app/components/TitleSection.vue
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>hello world!</div>
|
||||||
|
</template>
|
||||||
@ -18,7 +18,25 @@ if (!page.value) {
|
|||||||
<article
|
<article
|
||||||
class="prose prose-invert prose-orange m-auto min-h-[70%] max-w-screen-lg px-12 pb-20"
|
class="prose prose-invert prose-orange m-auto min-h-[70%] max-w-screen-lg px-12 pb-20"
|
||||||
>
|
>
|
||||||
<ContentRenderer v-if="page" :value="page" />
|
<h1 class="pb-0! mb-0! leading-none!" v-if="page?.title">
|
||||||
|
{{ page.title }}
|
||||||
|
</h1>
|
||||||
|
<div class="opacity-60">
|
||||||
|
<a v-if="page?.author" :href="page.author.url">{{
|
||||||
|
page.author.name
|
||||||
|
}}</a>
|
||||||
|
<span v-if="page?.author && page?.date" class="mx-2">•</span>
|
||||||
|
<span v-if="page?.date">{{
|
||||||
|
new Date(page.date).toLocaleDateString(undefined, {
|
||||||
|
year: "numeric",
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
})
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
<ContentRenderer class="mt-10" v-if="page" :value="page">
|
||||||
|
Hello
|
||||||
|
</ContentRenderer>
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { defineContentConfig, defineCollection } from "@nuxt/content";
|
import { defineContentConfig, defineCollection, property } from "@nuxt/content";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export default defineContentConfig({
|
export default defineContentConfig({
|
||||||
@ -6,11 +6,16 @@ export default defineContentConfig({
|
|||||||
blog: defineCollection({
|
blog: defineCollection({
|
||||||
type: "page",
|
type: "page",
|
||||||
source: "blog/*.md",
|
source: "blog/*.md",
|
||||||
// Define custom schema for docs collection
|
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
tags: z.array(z.string()),
|
hero: property(z.object({})).inherit(
|
||||||
|
"app/components/TitleSection.vue",
|
||||||
|
),
|
||||||
date: z.date(),
|
date: z.date(),
|
||||||
author: z.string(),
|
author: z.object({
|
||||||
|
name: z.string(),
|
||||||
|
url: z.string().url(),
|
||||||
|
}),
|
||||||
|
title: z.string(),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
date: 2026-02-06
|
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.
|
Some updates occured this week.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
date: 2026-02-07
|
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.
|
Some updates occured this week.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
# Blog
|
---
|
||||||
|
title: Blog
|
||||||
|
---
|
||||||
|
|
||||||
::BlogList
|
::BlogList
|
||||||
::
|
::
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user