mirror of
https://github.com/10h30/astroplate.git
synced 2026-06-05 15:08:00 +09:00
zod schema modified
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
import { z } from "zod";
|
|
||||||
|
|
||||||
const AboutSchema = z.object({
|
|
||||||
title: z.string(),
|
|
||||||
meta_title: z.string().optional(),
|
|
||||||
description: z.string().optional(),
|
|
||||||
image: z.string(),
|
|
||||||
draft: z.boolean().optional(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default AboutSchema;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { defineCollection, z } from "astro:content";
|
|
||||||
|
|
||||||
// Author collection schema
|
|
||||||
const authorsCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
meta_title: z.string().optional(),
|
|
||||||
email: z.string().optional(),
|
|
||||||
image: z.string().optional(),
|
|
||||||
description: z.string().optional(),
|
|
||||||
social: z
|
|
||||||
.array(
|
|
||||||
z
|
|
||||||
.object({
|
|
||||||
name: z.string().optional(),
|
|
||||||
icon: z.string().optional(),
|
|
||||||
link: z.string().optional(),
|
|
||||||
})
|
|
||||||
.optional(),
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
draft: z.boolean().optional(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Export collections
|
|
||||||
export const collections = {
|
|
||||||
authors: authorsCollection,
|
|
||||||
};
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import { defineCollection, z } from "astro:content";
|
|
||||||
|
|
||||||
// Post collection schema
|
|
||||||
const blogCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
meta_title: z.string().optional(),
|
|
||||||
description: z.string().optional(),
|
|
||||||
date: z.date().optional(),
|
|
||||||
image: z.string().optional(),
|
|
||||||
author: z.string().default("Admin"),
|
|
||||||
categories: z.array(z.string()).default(["others"]),
|
|
||||||
tags: z.array(z.string()).default(["others"]),
|
|
||||||
draft: z.boolean().optional(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Pages collection schema
|
|
||||||
const pagesCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
meta_title: z.string().optional(),
|
|
||||||
description: z.string().optional(),
|
|
||||||
image: z.string().optional(),
|
|
||||||
draft: z.boolean().optional(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Export collections
|
|
||||||
export const collections = {
|
|
||||||
blog: blogCollection,
|
|
||||||
pages: pagesCollection,
|
|
||||||
};
|
|
||||||
+88
-1
@@ -1,6 +1,6 @@
|
|||||||
import { defineCollection, z } from "astro:content";
|
import { defineCollection, z } from "astro:content";
|
||||||
|
|
||||||
// Post collection schema
|
// Blog collection schema
|
||||||
const blogCollection = defineCollection({
|
const blogCollection = defineCollection({
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
@@ -49,9 +49,96 @@ const pagesCollection = defineCollection({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Contact collection schema
|
||||||
|
const contactCollection = defineCollection({
|
||||||
|
schema: z.object({
|
||||||
|
title: z.string(),
|
||||||
|
meta_title: z.string().optional(),
|
||||||
|
description: z.string(),
|
||||||
|
image: z.string().optional(),
|
||||||
|
draft: z.boolean().optional(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// About collection schema
|
||||||
|
const aboutCollection = defineCollection({
|
||||||
|
schema: z.object({
|
||||||
|
title: z.string(),
|
||||||
|
meta_title: z.string().optional(),
|
||||||
|
description: z.string().optional(),
|
||||||
|
image: z.string(),
|
||||||
|
draft: z.boolean().optional(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Banner schema
|
||||||
|
const bannerSchema = z.object({
|
||||||
|
title: z.string(),
|
||||||
|
content: z.string(),
|
||||||
|
image: z.string(),
|
||||||
|
button: z.object({
|
||||||
|
enable: z.boolean(),
|
||||||
|
label: z.string(),
|
||||||
|
link: z.string(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Features schema
|
||||||
|
const featureSchema = z.object({
|
||||||
|
title: z.string(),
|
||||||
|
image: z.string(),
|
||||||
|
content: z.string(),
|
||||||
|
bulletpoints: z.array(z.string()),
|
||||||
|
button: z.object({
|
||||||
|
enable: z.boolean(),
|
||||||
|
label: z.string().optional(),
|
||||||
|
link: z.string().optional(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Content schema (for the main content structure with banner and features)
|
||||||
|
const contentSchema = z.object({
|
||||||
|
banner: bannerSchema,
|
||||||
|
features: z.array(featureSchema),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Content collection schema
|
||||||
|
const contentCollection = defineCollection({
|
||||||
|
schema: contentSchema,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Testimonial schema
|
||||||
|
const testimonialSchema = z.object({
|
||||||
|
name: z.string(),
|
||||||
|
designation: z.string(),
|
||||||
|
avatar: z.string(),
|
||||||
|
content: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Testimonials schema
|
||||||
|
const testimonialsSchema = z.array(testimonialSchema);
|
||||||
|
|
||||||
|
// Call to Action schema
|
||||||
|
const callToActionSchema = z.object({
|
||||||
|
enable: z.boolean(),
|
||||||
|
title: z.string(),
|
||||||
|
image: z.string(),
|
||||||
|
description: z.string(),
|
||||||
|
button: z.object({
|
||||||
|
enable: z.boolean(),
|
||||||
|
label: z.string(),
|
||||||
|
link: z.string().url(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
// Export collections
|
// Export collections
|
||||||
export const collections = {
|
export const collections = {
|
||||||
blog: blogCollection,
|
blog: blogCollection,
|
||||||
authors: authorsCollection,
|
authors: authorsCollection,
|
||||||
pages: pagesCollection,
|
pages: pagesCollection,
|
||||||
|
contact: contactCollection,
|
||||||
|
about: aboutCollection,
|
||||||
|
content: contentCollection,
|
||||||
|
testimonials: testimonialsSchema,
|
||||||
|
callToAction: callToActionSchema,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import { defineCollection, z } from "astro:content";
|
|
||||||
|
|
||||||
const contactCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
meta_title: z.string().optional(),
|
|
||||||
description: z.string(),
|
|
||||||
draft: z.boolean().optional(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const collections = {
|
|
||||||
contact: contactCollection,
|
|
||||||
};
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
import { defineCollection, z } from "astro:content";
|
|
||||||
|
|
||||||
// Banner schema
|
|
||||||
const bannerSchema = z.object({
|
|
||||||
title: z.string(),
|
|
||||||
content: z.string(),
|
|
||||||
image: z.string(),
|
|
||||||
button: z.object({
|
|
||||||
enable: z.boolean(),
|
|
||||||
label: z.string(),
|
|
||||||
link: z.string(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Features schema
|
|
||||||
const featureSchema = z.object({
|
|
||||||
title: z.string(),
|
|
||||||
image: z.string(),
|
|
||||||
content: z.string(),
|
|
||||||
bulletpoints: z.array(z.string()),
|
|
||||||
button: z.object({
|
|
||||||
enable: z.boolean(),
|
|
||||||
label: z.string().optional(),
|
|
||||||
link: z.string().optional(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Main content schema
|
|
||||||
const contentSchema = z.object({
|
|
||||||
banner: bannerSchema,
|
|
||||||
features: z.array(featureSchema),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Define the collection
|
|
||||||
const contentCollection = defineCollection({
|
|
||||||
schema: contentSchema,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Export collections
|
|
||||||
export const collections = {
|
|
||||||
content: contentCollection,
|
|
||||||
};
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { z } from "zod";
|
|
||||||
|
|
||||||
const TestimonialSchema = z.object({
|
|
||||||
name: z.string(),
|
|
||||||
designation: z.string(),
|
|
||||||
avatar: z.string(),
|
|
||||||
content: z.string(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const TestimonialsSchema = z.array(TestimonialSchema);
|
|
||||||
|
|
||||||
const CallToActionSchema = z.object({
|
|
||||||
enable: z.boolean(),
|
|
||||||
title: z.string(),
|
|
||||||
image: z.string(),
|
|
||||||
description: z.string(),
|
|
||||||
button: z.object({
|
|
||||||
enable: z.boolean(),
|
|
||||||
label: z.string(),
|
|
||||||
link: z.string().url(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const collections = {
|
|
||||||
Testimonial: TestimonialSchema,
|
|
||||||
Testimonials: TestimonialsSchema,
|
|
||||||
CallToAction: CallToActionSchema,
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user