Using a combination of Astro's new Content Layer API and Zod transforms, you can switch between data sources with ease and little to no changes to your templates.
Content Layer API: astro.build/blog/content-layer-deep-dive/
Hygraph Loader: www.npmjs.com/package/@hygraph/hygraph-astro-loade…
00:00 Mind blown
00:34 Matt Kane on Zod transforms
00:52 What this actually means
01:30 Into code
02:31 Removing Markdown and adding Hygraph Data
04:30 Transforming the data
06:14 Fixing the Zod types
09:03 Fixing slugs
09:11 Adding the Content component
10:58 Closing
コメント