Inital commit of Astro Website
This commit is contained in:
46
src/content.config.ts
Normal file
46
src/content.config.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { z, defineCollection, reference } from 'astro:content';
|
||||
import { glob, file } from 'astro/loaders';
|
||||
|
||||
const blogCollection = defineCollection({
|
||||
loader: glob({ pattern: "**/*.(md|mdx)", base: "./src/content/blog" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
summary: z.string(),
|
||||
pubDate: z.date(),
|
||||
}),
|
||||
});
|
||||
|
||||
const portfolioCollection = defineCollection({
|
||||
loader: glob({ pattern: "**/*.(md|mdx)", base: "./src/content/portfolio" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
summary: z.string(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
pubDate: z.date(),
|
||||
}),
|
||||
});
|
||||
|
||||
const bookChapters = defineCollection({
|
||||
loader: file("./src/content/book/chapters.json"),
|
||||
schema: z.object({
|
||||
name: z.string(),
|
||||
order: z.number(),
|
||||
subtitle: z.string(),
|
||||
})
|
||||
});
|
||||
|
||||
const bookCollection = defineCollection({
|
||||
loader: glob({ pattern: "**/*.(md|mdx)", base: "./src/content/book" }),
|
||||
schema: z.object({
|
||||
chapter: reference("bookChapters"),
|
||||
title: z.string(),
|
||||
summary: z.string().optional(),
|
||||
part: z.number(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = {
|
||||
blog: blogCollection,
|
||||
portfolio: portfolioCollection,
|
||||
book: bookCollection,
|
||||
};
|
||||
Reference in New Issue
Block a user