Created
December 19, 2024 14:54
-
-
Save jelmerdemaat/f54b054bbd5907c5971212d0da3eaeea to your computer and use it in GitHub Desktop.
Content config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { z, defineCollection } from ‘astro:content’; | |
import { glob } from ‘astro/loaders’; | |
const incidenten = defineCollection({ | |
loader: glob({ pattern: ‘*.md’, base: ‘./src/content/incidenten/’ }), | |
schema: z.object({ | |
_wp_id: z.number().optional().nullable(), | |
_uuid: z.string().optional().nullable(), | |
_published_at: z.date().optional().nullable(), | |
title: z.string(), | |
date: z.date(), | |
description: z.string().optional().nullable(), | |
twitterText: z.string().optional().nullable(), | |
location: z.string().optional().nullable(), | |
location_description: z.string().optional().nullable(), | |
type: z.array(z.string()).optional().nullable(), | |
status: z.string(), | |
publish_to_socials: z | |
.object({ | |
brandweer: z.object({ | |
twitter: z.boolean(), | |
facebook: z.boolean(), | |
instagram: z.boolean(), | |
}), | |
vrzhz: z.object({ | |
twitter: z.boolean(), | |
facebook: z.boolean(), | |
instagram: z.boolean(), | |
}), | |
}) | |
.optional() | |
.nullable(), | |
alert_regions: z.array(z.string()).optional().nullable(), | |
updates: z | |
.array( | |
z.object({ | |
_uuid: z.string().optional().nullable(), | |
_published_at: z.date().optional().nullable(), | |
update_date: z.date().optional().nullable(), | |
update_description: z.string().optional().nullable(), | |
update_images: z | |
.array( | |
z.object({ | |
update_image_url: z | |
.string() | |
.optional() | |
.nullable(), | |
update_image_alt: z | |
.string() | |
.optional() | |
.nullable(), | |
update_image_caption: z | |
.string() | |
.optional() | |
.nullable(), | |
}) | |
) | |
.optional() | |
.nullable(), | |
publish_to_socials: z | |
.object({ | |
twitter: z.boolean(), | |
facebook: z.boolean(), | |
instagram: z.boolean(), | |
}) | |
.optional() | |
.nullable(), | |
}) | |
) | |
.optional() | |
.nullable(), | |
}), | |
}); | |
// 3. Export a single `collections` object to register your collection(s) | |
export const collections = { | |
incidenten, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment