#Hi I am following the tutorial

3 messages · Page 1 of 1 (latest)

weak agate
#

const casino = defineCollection({
type: 'content',
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),
description: z.string(),
// Transform string to Date object
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
// heroImage: z.string().optional(),
// featured_media: z.string(),
draft: z.boolean().default(false),
software: z.array(z.string()),
author: z.string(),
casino_overall_rating: z.number(),
casino_external_link: z.string(),
section_header_0: z.string(),
section_text_0: z.string(),
// WARNING: of the below, see example here:
// https://www.learnwithjason.dev/blog/typesafe-markdown-astro-content-collections/
// date: z.date().transform((str) => new Date(str)),
// category: z.enum(['food', 'wisdom']),
// tags: z.array(z.string()).optional(),
// share: z
// .object({
// image: z.string().url().optional(),
// title: z.string(),
// description: z.string(),
// })
// .strict(),
}),
});

const imageCollection = defineCollection({
schema: ({ image }) => z.object({
title: z.string(),
cover: image().refine((img) => img.width >= 200, {
message: "Cover image must be at least 1080 pixels wide!",
}),
coverAlt: z.string(),
}),
});

// 3. Export a single collections object to register your collection(s)
// This key should match your collection directory name in "src/content"
// export const collections = { casino };

export const collections = {
'casino': casino,
'image': imageCollection,
};

#

do. I then need 2 collections?

#

but the tutorial literally says this:
er: "./firstpostcover.jpeg" # will resolve to "src/content/blog/firstblogcover.jpeg"