Frontend2026년 3월 10일2분 읽기

Astro 5 — 콘텐츠 레이어 통합과 Server Islands

YS
YoungSam
조회 898

Content Layer API

// src/content.config.ts
import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders";

const blog = defineCollection({
  loader: glob({ pattern: "**/*.md", base: "./content/blog" }),
  schema: z.object({
    title: z.string(),
    date: z.date(),
  }),
});

Server Islands

---
import UserGreeting from "../components/UserGreeting.astro";
---
<html>
  <h1>정적 콘텐츠</h1>
  <!-- 이 부분만 서버에서 동적 렌더링 -->
  <UserGreeting server:defer />
</html>

페이지 대부분은 정적으로, 일부만 동적으로 렌더링합니다.

AstroContent LayerSSG

댓글 0

아직 댓글이 없습니다.