mirror of
https://github.com/withastro/astro.git
synced 2025-02-10 22:38:53 -05:00
25 lines
517 B
TypeScript
25 lines
517 B
TypeScript
import { defineConfig } from 'astro/config';
|
|
import db, { defineCollection, field } from '@astrojs/db';
|
|
import { asJson, createGlob } from './utils';
|
|
|
|
const Quote = defineCollection({
|
|
fields: {
|
|
author: field.text(),
|
|
body: field.text(),
|
|
file: field.text({ unique: true }),
|
|
},
|
|
});
|
|
|
|
export default defineConfig({
|
|
db: {
|
|
collections: { Quote },
|
|
data({ seed, ...ctx }) {
|
|
const glob = createGlob(ctx);
|
|
glob('quotes/*.json', {
|
|
into: Quote,
|
|
parse: asJson,
|
|
});
|
|
},
|
|
},
|
|
integrations: [db()],
|
|
});
|