Use JSON file for track rendering

This commit is contained in:
thiloho
2025-04-28 03:58:54 +02:00
parent 4a4e1a0ae9
commit 27c42cbe6f
3 changed files with 195 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders";
import { glob, file } from "astro/loaders";
const blog = defineCollection({
loader: glob({ pattern: "**/*.md", base: "./src/content/blog" }),
@@ -11,4 +11,17 @@ const blog = defineCollection({
}),
});
export const collections = { blog };
const tracks = defineCollection({
loader: file("./src/content/tracks.json"),
schema: ({ image }) =>
z.object({
id: z.number().positive(),
title: z.string(),
youtubeLink: z.string().url(),
artist: z.string(),
album: z.string(),
cover: image(),
}),
});
export const collections = { blog, tracks };