From d2d4a361f9caf530fb6314264a3d8480826393e2 Mon Sep 17 00:00:00 2001 From: LuanRoger Date: Thu, 7 Dec 2023 19:53:40 -0300 Subject: [PATCH] feat(config): mirror config from blog --- README.md | 5 ++++- content/config.ts | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 content/config.ts diff --git a/README.md b/README.md index 347b26e..cdac59b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # Content + Here contains all the content and data for LR Tech Blog. It uses the Astro's Content Collection feature to manage them. The content is written in MDX and the data is written in JSON. ## Raise an Issue + For now we not accepting any PRs, but you can raise an issue if you found any error or want to suggest something. ## Discussions + If you have any question or want to discuss something about the content or just share some ideas, you can start a discussion. -[![Discuss on GitHub](https://img.shields.io/badge/Discussions-GitHub-333333?logo=github)](https://github.com/LR-Tech-Blog/content/discussions) \ No newline at end of file +[![Discuss on GitHub](https://img.shields.io/badge/Discussions-GitHub-333333?logo=github)](https://github.com/LR-Tech-Blog/content/discussions) diff --git a/content/config.ts b/content/config.ts new file mode 100644 index 0000000..7d4a026 --- /dev/null +++ b/content/config.ts @@ -0,0 +1,51 @@ +import { z, defineCollection, reference } from "astro:content"; + +const blogCollection = defineCollection({ + type: "content", + schema: z.object({ + id: z.string(), + title: z.string(), + author: reference("authors"), + date: z.date(), + draft: z.boolean(), + tags: z.array(z.string()), + postType: z.string(), + description: z.string(), + image: z.object({ + src: z.string(), + alt: z.string() + }) + }) +}) + +const authorProfile = defineCollection({ + type: "data", + schema: z.object({ + name: z.string(), + age: z.number(), + email: z.string(), + linkedin: z.string().url(), + github: z.string().url(), + profileImageUrl: z.string().url().nullable(), + profileImageAlt: z.string().nullable(), + profileImageType: z.enum(["URL", "Gravatar"]), + stack: z.array(z.object({ + name: z.string(), + iconName: z.string(), + iconColor: z.string(), + })), + }) +}) + +const authorDescription = defineCollection({ + type: "content", + schema: z.object({ + author: reference("authors") + }) +}) + +export const collections = { + 'posts': blogCollection, + 'authors': authorProfile, + 'authorsDescription': authorDescription +} \ No newline at end of file