mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
14e2936608
* Create astro-paper.code-snippets * feat: allow nullable modDatetime this is needed to allow the snippet to work with a blank date time, and is a precursor of adding in a modified date time setting hook * Update astro-paper.code-snippets to make feat false by default
27 lines
801 B
TypeScript
27 lines
801 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(),
|
|
modDatetime: z.date().optional().nullable(),
|
|
title: z.string(),
|
|
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 };
|