fix: enable live editing on homepage with {...homepage.edit.field} attributes

Adds content binding on Base component for homepage live editing navigation.
Uses homepage.id (entry ULID) not homepage.data.id (not in homepage schema).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kunthawat Greethong
2026-04-30 13:11:02 +07:00
parent 07725f9023
commit 8094cec877

View File

@@ -1,13 +1,14 @@
---
import { getEmDashEntry } from "emdash";
import { Image } from "emdash/ui";
import Base from "../layouts/Base.astro";
const { entry: homepage } = await getEmDashEntry("homepage", "main");
Astro.cache.set(homepage.cacheHint);
const d = homepage.data;
---
<Base title="EmDash CMS - Self-Hosted for Astro" description="Fully self-hosted CMS for Astro. No cloud required, fully local, with admin panel, authentication, and plugin system.">
<Base title="EmDash CMS - Self-Hosted for Astro" description="Fully self-hosted CMS for Astro. No cloud required, fully local, with admin panel, authentication, and plugin system."
content={{ collection: "homepage", id: homepage.id, slug: "main" }}
>
<main class="landing">
<!-- Hero Section -->
<section class="hero">
@@ -34,11 +35,7 @@ const d = homepage.data;
</a>
</div>
</div>
<div class="hero-visual" {...homepage.edit.hero_image}>
{d.hero_image?.src && (
<Image image={d.hero_image} />
)}
{!d.hero_image?.src && (
<div class="hero-visual">
<div class="code-window">
<div class="code-header">
<span class="dot red"></span>