mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +02:00

- remove preload comment configuration - remove preload meta tags in head - update 404 page
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { glob } from 'astro/loaders'
|
|
import { defineCollection, z } from 'astro:content'
|
|
import { allLocales } from '@/config'
|
|
|
|
const posts = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/posts' }),
|
|
schema: z.object({
|
|
// required
|
|
title: z.string(),
|
|
published: z.date(),
|
|
// optional
|
|
description: z.string().optional().default(''),
|
|
updated: z.date().optional(),
|
|
tags: z.array(z.string()).optional().default([]),
|
|
// Advanced
|
|
draft: z.boolean().optional().default(false),
|
|
pin: z.number().int().min(0).max(99).optional().default(0),
|
|
toc: z.boolean().optional().default(true),
|
|
lang: z.enum(['', ...allLocales]).optional().default(''),
|
|
abbrlink: z.string().optional().default('').refine(
|
|
abbrlink => !abbrlink || /^[a-z0-9\-]*$/.test(abbrlink),
|
|
{ message: 'Abbrlink can only contain lowercase letters, numbers and hyphens' },
|
|
),
|
|
}),
|
|
})
|
|
|
|
const about = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/about' }),
|
|
schema: z.object({
|
|
lang: z.enum(['', ...allLocales]).optional().default(''),
|
|
}),
|
|
})
|
|
|
|
export const collections = { posts, about }
|