mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-11 18:56:06 +09:00
54 lines
1.4 KiB
TypeScript
Executable File
54 lines
1.4 KiB
TypeScript
Executable File
import { defineCollection, z } from "astro:content";
|
|
|
|
// Post collection schema
|
|
const blogCollection = defineCollection({
|
|
schema: z.object({
|
|
title: z.string(),
|
|
meta_title: z.string().optional(),
|
|
description: z.string().optional(),
|
|
date: z.date().optional(),
|
|
image: z.string().optional(),
|
|
author: z.string().default("Admin"),
|
|
categories: z.array(z.string()).default(["others"]),
|
|
tags: z.array(z.string()).default(["others"]),
|
|
draft: z.boolean().optional(),
|
|
}),
|
|
});
|
|
|
|
// Author collection schema
|
|
const authorsCollection = defineCollection({
|
|
schema: z.object({
|
|
title: z.string(),
|
|
meta_title: z.string().optional(),
|
|
email: z.string().optional(),
|
|
image: z.string().optional(),
|
|
description: z.string().optional(),
|
|
social: z
|
|
.object({
|
|
facebook: z.string().optional(),
|
|
twitter: z.string().optional(),
|
|
instagram: z.string().optional(),
|
|
})
|
|
.optional(),
|
|
draft: z.boolean().optional(),
|
|
}),
|
|
});
|
|
|
|
// Pages collection schema
|
|
const pagesCollection = defineCollection({
|
|
schema: z.object({
|
|
title: z.string(),
|
|
meta_title: z.string().optional(),
|
|
description: z.string().optional(),
|
|
image: z.string().optional(),
|
|
draft: z.boolean().optional(),
|
|
}),
|
|
});
|
|
|
|
// Export collections
|
|
export const collections = {
|
|
blog: blogCollection,
|
|
authors: authorsCollection,
|
|
pages: pagesCollection,
|
|
};
|