Skip to content

Commit

Permalink
delete: 删除问题代码
Browse files Browse the repository at this point in the history
  • Loading branch information
luobin committed Aug 21, 2024
1 parent 9ab6f54 commit 0c89b22
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions faq/customize-kbar-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,6 @@ import { Blog } from 'contentlayer/generated'
export const SearchProvider = ({ children }) => {
const router = useRouter()
return (
<KBarSearchProvider
kbarConfig={{
searchDocumentsPath: 'search.json',
defaultActions: [
{
id: 'homepage',
name: 'Homepage',
keywords: '',
shortcut: ['h', 'h'],
section: 'Home',
perform: () => router.push('/'),
},
{
id: 'projects',
name: 'Projects',
keywords: '',
shortcut: ['p'],
section: 'Home',
perform: () => router.push('/projects'),
},
],
onSearchDocumentsLoad(json) {
return json.map((post: CoreContent<Blog>) => ({
id: post.path,
name: post.title,
keywords: post?.summary || '',
section: 'Blog',
subtitle: post.tags.join(', '),
perform: () => router.push('/' + post.path),
}))
},
}}
>
{children}
</KBarSearchProvider>
)
}
```
Expand All @@ -66,7 +31,7 @@ function createSearchIndex(allBlogs) {
) {
writeFileSync(
`public/${siteMetadata.search.kbarConfig.searchDocumentsPath}`,
JSON.stringify((sortPosts(allBlogs)))
JSON.stringify(sortPosts(allBlogs))
)
console.log('Local search index generated...')
}
Expand Down

0 comments on commit 0c89b22

Please sign in to comment.