mirror of
https://github.com/jaronpate/folio.git
synced 2026-10-19 01:07:39 +00:00
feat: added nuxt content
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineContentConfig, defineCollection } from '@nuxt/content';
|
||||
|
||||
export default defineContentConfig({
|
||||
collections: {
|
||||
writing: defineCollection({
|
||||
type: 'page',
|
||||
source: 'writing/**/*.md',
|
||||
}),
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
# Hello Content
|
||||
|
||||
blah blah blah
|
||||
@@ -0,0 +1,3 @@
|
||||
# Hello Content
|
||||
|
||||
blah blah blah
|
||||
@@ -2,11 +2,33 @@
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: '2026-04-28',
|
||||
devtools: { enabled: true },
|
||||
|
||||
nitro: {
|
||||
prerender: {
|
||||
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: {
|
||||
head: {
|
||||
htmlAttrs: { lang: 'en' },
|
||||
@@ -22,4 +44,6 @@ export default defineNuxtConfig({
|
||||
link: [{ rel: 'icon', type: 'image/png', href: '/favicon.png' }],
|
||||
},
|
||||
},
|
||||
|
||||
modules: ['@nuxt/content'],
|
||||
});
|
||||
|
||||
+4
-1
@@ -11,9 +11,12 @@
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/content": "3.13.0",
|
||||
"better-sqlite3": "^12.9.0",
|
||||
"nuxt": "^4.4.2",
|
||||
"vue": "^3.5.33",
|
||||
"vue-router": "^5.0.6"
|
||||
"vue-router": "^5.0.6",
|
||||
"wrangler": "^4.86.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.8.3"
|
||||
|
||||
Reference in New Issue
Block a user