Skip to content

Commit 7e87ee1

Browse files
committed
feat: switch from nuxt/content to unplug-vue-markdown
1 parent 6fc3a8f commit 7e87ee1

15 files changed

Lines changed: 225 additions & 79 deletions

app/components/BlogPostWrapper.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup lang="ts">
2+
import type { BlogPostFrontmatter } from '#shared/schemas/blog'
3+
4+
const props = defineProps<{
5+
frontmatter?: BlogPostFrontmatter
6+
}>()
7+
8+
useSeoMeta({
9+
title: props.frontmatter?.title,
10+
description: props.frontmatter?.description || props.frontmatter?.excerpt,
11+
ogTitle: props.frontmatter?.title,
12+
ogDescription: props.frontmatter?.description || props.frontmatter?.excerpt,
13+
ogType: 'article',
14+
})
15+
</script>
16+
<template>
17+
<main class="container w-full">
18+
<article class="prose dark:prose-invert mx-auto">
19+
<slot />
20+
</article>
21+
</main>
22+
</template>

app/pages/blog/[slug].vue

Lines changed: 0 additions & 39 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

app/pages/blog/index.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
<script setup lang="ts">
2-
const { data: posts } = await useAsyncData('blog-posts', () =>
3-
queryCollection('blog').where('draft', '<>', true).order('date', 'DESC').all(),
4-
)
2+
import type { BlogPostFrontmatter } from '#shared/schemas/blog'
3+
4+
const blogModules = import.meta.glob<BlogPostFrontmatter>('./*.md', { eager: true })
5+
6+
const posts: BlogPostFrontmatter[] = []
7+
8+
for (const [path, module] of Object.entries(blogModules)) {
9+
if (module.draft) continue
10+
11+
posts.push({ ...module })
12+
}
13+
14+
posts.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
515
616
const placeHolder = ['atproto', 'nuxt']
717
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
author: 'Daniel Roe'
23
title: 'Server Components'
34
date: '2026-01-28'
45
slug: 'server-components'

app/plugins/blog-wrapper.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import BlogPostWrapper from '~/components/BlogPostWrapper.vue'
2+
3+
export default defineNuxtPlugin(nuxtApp => {
4+
nuxtApp.vueApp.component('BlogPostWrapper', BlogPostWrapper)
5+
})

0 commit comments

Comments
 (0)