fix(homepage): move section rendering into the Astro template

- keep homepage section data driven from structured frontmatter
- render typed section components inside the template map instead of frontmatter helper code
- resolve the Astro parse error in HomePage.astro
- preserve the existing homepage section order and component split
This commit is contained in:
2026-06-11 14:26:02 -07:00
parent a163ff98c9
commit 965c090782
+5 -7
View File
@@ -38,8 +38,9 @@ function fromHomeContent(home: HomePageContent): HomeSection[] {
const sections: HomeSection[] = entry.data.home const sections: HomeSection[] = entry.data.home
? fromHomeContent(entry.data.home) ? fromHomeContent(entry.data.home)
: ((entry.data.sections ?? []) as HomeSection[]); : ((entry.data.sections ?? []) as HomeSection[]);
---
function renderSection(section: HomeSection) { <BaseLayout {title} {description} {canonical} {lang}>
{sections.map((section) => {
switch (section.type) { switch (section.type) {
case 'hero': case 'hero':
return <HomeHero section={section} />; return <HomeHero section={section} />;
@@ -61,11 +62,8 @@ function renderSection(section: HomeSection) {
return <HomeDirector section={section} />; return <HomeDirector section={section} />;
case 'testimonials': case 'testimonials':
return <HomeTestimonials section={section} />; return <HomeTestimonials section={section} />;
} default:
return null; return null;
} }
--- })}
<BaseLayout {title} {description} {canonical} {lang}>
{sections.map(renderSection)}
</BaseLayout> </BaseLayout>