refactor: extract hardcoded content into astro content collections

This commit is contained in:
Zotov Ivan Yuryevich
2026-04-04 14:17:50 +03:00
parent ad3655c285
commit 18001a918f
39 changed files with 1368 additions and 993 deletions

19
src/content.config.ts Normal file
View File

@@ -0,0 +1,19 @@
import { defineCollection, z } from 'astro:content'
import { glob } from 'astro/loaders'
const vendorSchema = z.object({
name: z.string(),
description: z.string(),
products: z.array(z.string()).optional(),
})
const categories = defineCollection({
loader: glob({ pattern: '**/*.json', base: './src/content/categories' }),
schema: z.object({
title: z.string(),
description: z.string(),
vendors: z.array(vendorSchema),
}),
})
export const collections = { categories }