diff --git a/src/helpers/schema.ts b/src/helpers/schema.ts index 950f3ec..ff7c1c0 100644 --- a/src/helpers/schema.ts +++ b/src/helpers/schema.ts @@ -1,6 +1,6 @@ import { defaultCover } from '@/content/config.ts'; import options from '@/options'; -import { getCollection, type Render } from 'astro:content'; +import { getCollection, getEntry, type Render } from 'astro:content'; // Import the collections from the astro content. const categoriesCollection = await getCollection('categories'); @@ -24,6 +24,7 @@ export type Post = (typeof postsCollection)[number]['data'] & { slug: string; permalink: string; render: () => Render['.mdx']; + raw: () => Promise; }; export type Tag = (typeof tagsCollection)[number]['data'][number] & { counts: number; permalink: string }; @@ -44,6 +45,10 @@ export const posts: Post[] = postsCollection slug: post.slug, permalink: `/posts/${post.slug}`, render: post.render, + raw: async () => { + const entry = await getEntry('posts', post.slug); + return entry.body; + }, ...post.data, })) .sort((left: Post, right: Post) => {