Initial commit
This commit is contained in:
commit
09a1919d36
152 changed files with 22845 additions and 0 deletions
64
src/content/config.ts
Normal file
64
src/content/config.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import { defineCollection, reference, z } from 'astro:content';
|
||||
|
||||
const user = z.union([z.string(), z.record(z.string().url())])
|
||||
|
||||
const lang = z.enum(['eng', 'tok']).default('eng')
|
||||
|
||||
export type User = z.output<typeof user>
|
||||
export type Lang = z.output<typeof lang>
|
||||
|
||||
const storiesCollection = defineCollection({
|
||||
type: 'content',
|
||||
schema: ({ image }) => z.object({
|
||||
title: z.string(),
|
||||
shortTitle: z.string().optional(),
|
||||
pubDate: z.date(),
|
||||
isDraft: z.boolean().default(false),
|
||||
authors: z.union([user, z.array(user)]).default('Bad Manners'),
|
||||
wordCount: z.number().int(),
|
||||
contentWarning: z.string(),
|
||||
description: z.string(),
|
||||
descriptionPlaintext: z.string().optional(),
|
||||
summary: z.string().optional(),
|
||||
thumbnail: image().optional(),
|
||||
thumbnailWidth: z.number().int().optional(),
|
||||
thumbnailHeight: z.number().int().optional(),
|
||||
tags: z.array(z.string()),
|
||||
series: z.record(z.string(), z.string()).optional(),
|
||||
commissioner: user.optional(),
|
||||
requester: user.optional(),
|
||||
copyrightedCharacters: z.record(z.string(), user).optional(),
|
||||
lang,
|
||||
prev: reference('stories').nullable().optional(),
|
||||
next: reference('stories').nullable().optional(),
|
||||
relatedStories: z.array(reference('stories')).optional(),
|
||||
relatedGames: z.array(reference('games')).optional(),
|
||||
}),
|
||||
})
|
||||
|
||||
const gamesCollection = defineCollection({
|
||||
type: 'content',
|
||||
schema: ({ image }) => z.object({
|
||||
title: z.string(),
|
||||
pubDate: z.date(),
|
||||
isDraft: z.boolean().default(false),
|
||||
authors: z.union([user, z.array(user)]).default('Bad Manners'),
|
||||
contentWarning: z.string(),
|
||||
description: z.string(),
|
||||
descriptionPlaintext: z.string().optional(),
|
||||
thumbnail: image().optional(),
|
||||
thumbnailWidth: z.number().int().optional(),
|
||||
thumbnailHeight: z.number().int().optional(),
|
||||
tags: z.array(z.string()),
|
||||
series: z.record(z.string(), z.string()).optional(),
|
||||
copyrightedCharacters: z.record(z.string(), user).optional(),
|
||||
lang,
|
||||
relatedStories: z.array(reference('stories')).optional(),
|
||||
relatedGames: z.array(reference('games')).optional(),
|
||||
}),
|
||||
})
|
||||
|
||||
export const collections = {
|
||||
stories: storiesCollection,
|
||||
games: gamesCollection,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue