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:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user