Initial design based off original website, some things still to do
This commit is contained in:
80
src/content.config.ts
Normal file
80
src/content.config.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import { glob } from "astro/loaders";
|
||||
import { defineCollection, z } from "astro:content";
|
||||
|
||||
const projects = defineCollection({
|
||||
loader: glob({ pattern: "**/*.mdx", base: "./src/assets/projects" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
role: z.string(),
|
||||
type: z.string(),
|
||||
date: z.date(),
|
||||
description: z.string(),
|
||||
frontPage: z
|
||||
.object({
|
||||
order: z.number()
|
||||
})
|
||||
.optional(),
|
||||
images: z.object({
|
||||
hero: z.object({
|
||||
src: z.preprocess(
|
||||
(val) => `/src/assets/img/project-heros/${val}`,
|
||||
z.string()
|
||||
),
|
||||
alt: z.string()
|
||||
}),
|
||||
other: z
|
||||
.preprocess((val) => `/src/assets/img/projects/${val}`, z.string())
|
||||
.optional()
|
||||
}),
|
||||
externalLinks: z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
href: z.string(),
|
||||
icon: z.string()
|
||||
})
|
||||
)
|
||||
.optional()
|
||||
})
|
||||
});
|
||||
|
||||
const awards = defineCollection({
|
||||
loader: glob({ pattern: "**/*.mdx", base: "./src/assets/awards" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
giver: z.string(),
|
||||
date: z.date()
|
||||
})
|
||||
});
|
||||
|
||||
const tracks = defineCollection({
|
||||
loader: glob({ pattern: "**/*.json", base: "./src/assets/tracks" }),
|
||||
schema: ({ image }) =>
|
||||
z.object({
|
||||
src: z.string(),
|
||||
metadata: z.object({
|
||||
title: z.string(),
|
||||
subtitle: z.string().optional(),
|
||||
extra: z.string().optional(),
|
||||
artist: z.string().optional().default("Nathan Cummins"),
|
||||
artwork: z.preprocess((val) => `/src/assets/img/tracks/${val}`, image())
|
||||
}),
|
||||
autoQueue: z
|
||||
.object({
|
||||
order: z.number()
|
||||
})
|
||||
.optional(),
|
||||
card: z.object({
|
||||
image: z.object({
|
||||
src: z.preprocess((val) => `/src/assets/img/tracks/${val}`, image()),
|
||||
alt: z.string()
|
||||
}),
|
||||
text: z.object({
|
||||
primary: z.string(),
|
||||
secondary: z.string()
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
export const collections = { projects, awards, tracks };
|
||||
Reference in New Issue
Block a user