mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
27 lines
789 B
TypeScript
27 lines
789 B
TypeScript
import { SITE } from "@config";
|
|
import { defineCollection, z } from "astro:content";
|
|
|
|
const blog = defineCollection({
|
|
type: "content",
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
author: z.string().default(SITE.author),
|
|
pubDatetime: z.date(),
|
|
title: z.string(),
|
|
postSlug: z.string().optional(),
|
|
featured: z.boolean().optional(),
|
|
draft: z.boolean().optional(),
|
|
tags: z.array(z.string()).default(["others"]),
|
|
ogImage: image()
|
|
.refine(img => img.width >= 1200 && img.height >= 630, {
|
|
message: "OpenGraph image must be at least 1200 X 630 pixels!",
|
|
})
|
|
.or(z.string())
|
|
.optional(),
|
|
description: z.string(),
|
|
canonicalURL: z.string().optional(),
|
|
}),
|
|
});
|
|
|
|
export const collections = { blog };
|