Added Blog Page and Housekeeping

This commit is contained in:
Ahmad 2024-11-17 16:28:51 -05:00
parent db4bf103c3
commit d32415232e
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
18 changed files with 6860 additions and 769 deletions

31
content-collections.ts Normal file
View file

@ -0,0 +1,31 @@
import { defineCollection, defineConfig } from '@content-collections/core';
import { compileMDX } from '@content-collections/mdx';
const posts = defineCollection({
name: 'BlogPosts',
directory: 'app/(main)/blog/posts',
include: '*.mdx',
schema: (z) => ({
title: z
.string()
.min(3, { message: 'Title must be at least 3 characters' })
.max(30, { message: 'Title must be at most 30 characters' }),
summary: z
.string()
.min(10, { message: 'Summary must be at least 10 characters' })
.max(50, { message: 'Summary must be at most 50 characters' }),
coverImage: z.string(),
datePublished: z.string(),
}),
transform: async (document, context) => {
const mdx = await compileMDX(context, document);
return {
...document,
mdx,
};
},
});
export default defineConfig({
collections: [posts],
});