feat: added nuxt content

This commit is contained in:
Jaron
2026-04-29 23:06:11 -05:00
parent 3e79461faa
commit 846ebb44c9
11 changed files with 824 additions and 40 deletions
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
<script lang="ts" setup>
const route = useRoute();
const { data: page } = await useAsyncData(route.path, () => {
return queryCollection('writing').path(route.path).first();
});
if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page Not Found' });
}
useSeoMeta({
title: page.value?.title,
description: page.value?.description,
});
</script>
<template>
<div>
<ContentRenderer v-if="page" :value="page" />
</div>
</template>
+15
View File
@@ -0,0 +1,15 @@
<script setup lang="ts">
const { data: home } = await useAsyncData(() =>
queryCollection('writing').path('/writing').first(),
);
useSeoMeta({
title: home.value?.title,
description: home.value?.description,
});
</script>
<template>
<ContentRenderer v-if="home" :value="home" />
<div v-else>Home not found</div>
</template>
+744 -39
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
import { defineContentConfig, defineCollection } from '@nuxt/content';
export default defineContentConfig({
collections: {
writing: defineCollection({
type: 'page',
source: 'writing/**/*.md',
}),
},
});
+3
View File
@@ -0,0 +1,3 @@
# Hello Content
blah blah blah
+3
View File
@@ -0,0 +1,3 @@
# Hello Content
blah blah blah
+24
View File
@@ -2,11 +2,33 @@
export default defineNuxtConfig({ export default defineNuxtConfig({
compatibilityDate: '2026-04-28', compatibilityDate: '2026-04-28',
devtools: { enabled: true }, devtools: { enabled: true },
nitro: { nitro: {
prerender: { prerender: {
autoSubfolderIndex: false, autoSubfolderIndex: false,
}, },
preset: 'cloudflare_module',
cloudflare: {
deployConfig: true,
wrangler: {
d1_databases: [
{
binding: 'DB',
database_name: 'folio',
database_id: '6fd8a531-a673-479a-9501-3b406bb9f76e',
}, },
],
},
},
},
content: {
database: {
type: 'd1',
bindingName: 'DB',
},
},
app: { app: {
head: { head: {
htmlAttrs: { lang: 'en' }, htmlAttrs: { lang: 'en' },
@@ -22,4 +44,6 @@ export default defineNuxtConfig({
link: [{ rel: 'icon', type: 'image/png', href: '/favicon.png' }], link: [{ rel: 'icon', type: 'image/png', href: '/favicon.png' }],
}, },
}, },
modules: ['@nuxt/content'],
}); });
+4 -1
View File
@@ -11,9 +11,12 @@
"format": "prettier --write ." "format": "prettier --write ."
}, },
"dependencies": { "dependencies": {
"@nuxt/content": "3.13.0",
"better-sqlite3": "^12.9.0",
"nuxt": "^4.4.2", "nuxt": "^4.4.2",
"vue": "^3.5.33", "vue": "^3.5.33",
"vue-router": "^5.0.6" "vue-router": "^5.0.6",
"wrangler": "^4.86.0"
}, },
"devDependencies": { "devDependencies": {
"prettier": "^3.8.3" "prettier": "^3.8.3"