85 lines
2.2 KiB
TypeScript
85 lines
2.2 KiB
TypeScript
|
|
import { defineCollection, z, type ImageFunction } from "astro:content";
|
||
|
|
|
||
|
|
const blogCollection = defineCollection({
|
||
|
|
type: "content",
|
||
|
|
schema: z.object({
|
||
|
|
title: z.string(),
|
||
|
|
description: z.string(),
|
||
|
|
date: z.date(),
|
||
|
|
dateFormatted: z.string(),
|
||
|
|
category: z.enum(['pro', 'comedy', 'photo']),
|
||
|
|
tags: z.array(z.string()).optional(),
|
||
|
|
image: z.string().optional(),
|
||
|
|
imageAlt: z.string().optional(),
|
||
|
|
draft: z.boolean().default(false),
|
||
|
|
lang: z.enum(['fr', 'en', 'ar']).default('fr'),
|
||
|
|
}),
|
||
|
|
});
|
||
|
|
|
||
|
|
const projectsCollection = defineCollection({
|
||
|
|
type: "content",
|
||
|
|
schema: z.object({
|
||
|
|
title: z.string(),
|
||
|
|
description: z.string(),
|
||
|
|
date: z.date(),
|
||
|
|
dateFormatted: z.string(),
|
||
|
|
category: z.enum(['dev', 'comedy', 'photo']),
|
||
|
|
technologies: z.array(z.string()).optional(),
|
||
|
|
url: z.string().url().optional(),
|
||
|
|
github: z.string().url().optional(),
|
||
|
|
image: z.string().optional(),
|
||
|
|
imageAlt: z.string().optional(),
|
||
|
|
featured: z.boolean().default(false),
|
||
|
|
draft: z.boolean().default(false),
|
||
|
|
lang: z.enum(['fr', 'en', 'ar']).default('fr'),
|
||
|
|
}),
|
||
|
|
});
|
||
|
|
|
||
|
|
const talksCollection = defineCollection({
|
||
|
|
type: "content",
|
||
|
|
schema: z.object({
|
||
|
|
title: z.string(),
|
||
|
|
description: z.string(),
|
||
|
|
date: z.date(),
|
||
|
|
dateFormatted: z.string(),
|
||
|
|
event: z.string(),
|
||
|
|
location: z.string(),
|
||
|
|
slides: z.string().url().optional(),
|
||
|
|
video: z.string().url().optional(),
|
||
|
|
image: z.string().optional(),
|
||
|
|
imageAlt: z.string().optional(),
|
||
|
|
tags: z.array(z.string()).optional(),
|
||
|
|
draft: z.boolean().default(false),
|
||
|
|
lang: z.enum(['fr', 'en', 'ar']).default('fr'),
|
||
|
|
}),
|
||
|
|
});
|
||
|
|
|
||
|
|
const photoBlogPostsCollection = defineCollection({
|
||
|
|
type: "content",
|
||
|
|
schema: ({ image }) => z.object({
|
||
|
|
title: z.string(),
|
||
|
|
description: z.string(),
|
||
|
|
date: z.date(),
|
||
|
|
coverImage: image(),
|
||
|
|
tags: z.array(z.string()).optional(),
|
||
|
|
featured: z.boolean().default(false),
|
||
|
|
draft: z.boolean().default(false),
|
||
|
|
}),
|
||
|
|
});
|
||
|
|
|
||
|
|
const photoCategoriesCollection = defineCollection({
|
||
|
|
type: "data",
|
||
|
|
schema: z.object({
|
||
|
|
title: z.string(),
|
||
|
|
subtitle: z.string(),
|
||
|
|
order: z.number().optional(),
|
||
|
|
}),
|
||
|
|
});
|
||
|
|
|
||
|
|
export const collections = {
|
||
|
|
blog: blogCollection,
|
||
|
|
projects: projectsCollection,
|
||
|
|
talks: talksCollection,
|
||
|
|
photoBlogPosts: photoBlogPostsCollection,
|
||
|
|
photoCategories: photoCategoriesCollection,
|
||
|
|
};
|