From 11425c51baddeb2fdb67919ed6e03a216b985f5c Mon Sep 17 00:00:00 2001 From: Hsu Zhong Jun <27919917+dcshzj@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:37:23 +0800 Subject: [PATCH] fix: set hero subtitle as meta description of homepage (#892) --- packages/components/src/engine/metadata.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/components/src/engine/metadata.ts b/packages/components/src/engine/metadata.ts index 96c357c2d2..0b0f8ffb65 100644 --- a/packages/components/src/engine/metadata.ts +++ b/packages/components/src/engine/metadata.ts @@ -38,6 +38,13 @@ export const getMetadata = (props: IsomerPageSchemaType) => { props.layout === "collection" ) { metadata.description = props.page.subtitle + } else if ( + metadata.description === undefined && + props.layout === "homepage" + ) { + metadata.description = props.content.find( + (item) => item.type === "hero", + )?.subtitle } if (props.page.permalink === "/") {