refactor(homepage): drive homepage from structured frontmatter

- replace the flat homepage sections array with a named home: block
- validate homepage sections with typed Zod schemas
- make HomePage.astro render the structured content file data
- keep English and Spanish homepage copy easier to scan and edit
This commit is contained in:
2026-06-11 13:16:36 -07:00
parent 36f82a9a76
commit 1be3ad0410
5 changed files with 240 additions and 124 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';
import { homePageSchema, homeSectionsSchema } from './types/home-sections';
const language = z.enum(['en', 'ar', 'es']);
const shared = {
@@ -12,7 +13,8 @@ const shared = {
lang: language,
translationKey: z.string().optional(),
draft: z.boolean().default(false),
sections: z.array(z.record(z.unknown())).optional()
home: homePageSchema.optional(),
sections: homeSectionsSchema.optional()
};
const pages = defineCollection({