Skip to content

Commit

Permalink
chore: migrating fuse extendKeys config fields
Browse files Browse the repository at this point in the history
  • Loading branch information
WRXinYue committed Oct 31, 2024
1 parent 045bf18 commit 78fd0cf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion packages/valaxy/node/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const defaultSiteConfig: SiteConfig = {
},
fuse: {
dataPath: 'valaxy-fuse-list.json',
extendKeys: [],
options: {
keys: [],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy/node/modules/fuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function generateFuseList(options: ResolvedValaxyOptions) {
if (fmData.password)
continue

const extendKeys = options.config.siteConfig.fuse.extendKeys || []
const extendKeys = options.config.fuse?.extendKeys || []

// adapt for nested folders, like /posts/2021/01/01/index.md
const relativeLink = i.replace(`${options.userRoot}/pages`, '')
Expand Down
10 changes: 10 additions & 0 deletions packages/valaxy/node/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ export interface ValaxyExtendConfig {
icons?: Parameters<typeof presetIcons>[0]
typography?: Parameters<typeof presetTypography>[0]
}
fuse?: {
/**
* @en_US Extends the metadata fields returned by the search
* @zh_CN 扩展搜索返回的元数据字段
* @default []
* @description:en-US By default, returns the following fields: title, tags, categories, author, excerpt, link
* @description:zh-CN 默认返回以下字段:title、tags、categories、author、excerpt、link
*/
extendKeys?: string[]
}
/**
* @experimental
* Enable Vue Devtools & Valaxy Devtools
Expand Down
8 changes: 0 additions & 8 deletions packages/valaxy/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,6 @@ export interface SiteConfig {
* @description 搜索结果列表数据所在路径
*/
dataPath: string
/**
* @en_US Extends the metadata fields returned by the search
* @zh_CN 扩展搜索返回的元数据字段
* @default []
* @description:en-US By default, returns the following fields: title, tags, categories, author, excerpt, link
* @description:zh-CN 默认返回以下字段:title、tags、categories、author、excerpt、link
*/
extendKeys: (keyof PostFrontMatter)[]
/**
* @see https://fusejs.io/api/options.html
*/
Expand Down

0 comments on commit 78fd0cf

Please sign in to comment.