File: src/blocks/work/Work01.astro
Selected work / project grid from the projects content collection. Config supplies headings/CTA; projects must be fetched on the page and passed in.
Config (blocks.ts → work)
work: {
heading: "Selected work",
subheading: "A few recent projects. More case studies available on request.",
ctaLabel: "View all projects",
ctaUrl: "/work/",
},
Add to a page
---
import { getCollection } from "astro:content";
import Work01 from "@/blocks/work/Work01.astro";
const projects = (await getCollection("projects"))
.filter((p) => !p.data.draft)
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf());
---
<Work01 projects={projects} limit={3} />
Inline:
<Work01
projects={projects}
limit={6}
heading="Portfolio"
showCta={false}
/>
Props
| Prop | Config key | Notes |
|---|---|---|
sectionId |
— | Default "work" |
heading / subheading |
work.* |
|
projects |
— | Required — collection entries |
limit |
— | Max cards (default 3) |
showCta |
— | Default true |
ctaLabel / ctaUrl |
work.cta* |
Content collection
Projects live in src/content/projects/*.md. See Content.