Skip to content

Commit

Permalink
feat(config): mirror config from blog
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRoger committed Dec 7, 2023
1 parent da5348a commit d2d4a36
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
[![Discuss on GitHub](https://img.shields.io/badge/Discussions-GitHub-333333?logo=github)](https://github.com/LR-Tech-Blog/content/discussions)
51 changes: 51 additions & 0 deletions content/config.ts
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit d2d4a36

Please sign in to comment.