mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-05-04 04:33:10 +00:00
Added Blog Page and Housekeeping
This commit is contained in:
parent
db4bf103c3
commit
d32415232e
18 changed files with 6860 additions and 769 deletions
31
content-collections.ts
Normal file
31
content-collections.ts
Normal 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],
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue