fix: revert the raw method in post for searching.
This commit is contained in:
parent
efbaffeb2d
commit
fb9bf2dc72
@ -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<string>;
|
||||
};
|
||||
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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user