كل ملاحظات المختبر
ملاحظة مختبر 002مراجعةNext.js · Content · Dev Tools
First Look at Velite: The New Content Layer?
سجل تقني مركز: السياق والتفصيل المفيد ومسار التنفيذ.
ملاحظة عمل. قصيرة عن قصد، لكن مكتملة بما يكفي للعودة إليها عندما تظهر المشكلة نفسها من جديد.
Velite is a lightweight, file-based content layer built on top of Zod, designed to replace complex solutions like Contentlayer (now discontinued). It turns Markdown/MDX into strongly-typed JSON data.
Why use it?
Type Safety: Uses Zod schemas to validate and type content structure (e.g., ensuring a slug is always a string).
Simple Setup: Define your content schemas in velite.config.js and run the CLI.
Agnostic: Works great with Next.js, Astro, or any React framework.
jsSnippet// velite.config.js snippetdefineCollection({ name: "Post", schema: s.object({ slug: s.slug(), title: s.string().max(99), content: s.mdx(), }),});