Drastically simplify the drafts workflow
This commit is contained in:
13
_data/eleventyDataSchema.js
Normal file
13
_data/eleventyDataSchema.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { z } from "zod";
|
||||
import { fromZodError } from 'zod-validation-error';
|
||||
|
||||
export default function(data) {
|
||||
// Draft content, validate `draft` front matter
|
||||
let result = z.object({
|
||||
draft: z.boolean().or(z.undefined()),
|
||||
}).safeParse(data);
|
||||
|
||||
if(result.error) {
|
||||
throw fromZodError(result.error);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user