MDX: Store additional _data to search indexes

This commit is contained in:
fuma-nama
2024-08-29 12:53:54 +08:00
parent 8bc65dce0a
commit c0d1fafe30
2 changed files with 15 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-mdx': patch
---
Store additional `_data` to search indexes
@@ -18,6 +18,14 @@ export interface SearchIndex {
description?: string;
url: string;
structuredData: StructuredData;
/**
* VFile Data
*/
_data: {
frontmatter: Record<string, unknown>;
[key: string]: unknown;
};
}
export interface Options {
@@ -88,6 +96,7 @@ export class SearchIndexPlugin {
frontmatter: {
title: string;
description?: string;
[key: string]: unknown;
};
};
};
@@ -102,6 +111,7 @@ export class SearchIndexPlugin {
title: info.data.frontmatter.title,
description: info.data.frontmatter.description,
url: getUrl(relativePath),
_data: info.data,
});
}