fix: sort post for kbar search

This commit is contained in:
Timothy Lin 2023-08-05 12:05:53 +08:00
parent 354c628879
commit 2ea12dff88

View File

@ -20,7 +20,7 @@ import rehypeCitation from 'rehype-citation'
import rehypePrismPlus from 'rehype-prism-plus'
import rehypePresetMinify from 'rehype-preset-minify'
import siteMetadata from './data/siteMetadata'
import { allCoreContent } from 'pliny/utils/contentlayer.js'
import { allCoreContent, sortPosts } from 'pliny/utils/contentlayer.js'
const root = process.cwd()
@ -68,7 +68,7 @@ function createSearchIndex(allBlogs) {
) {
writeFileSync(
`public/${siteMetadata.search.kbarConfig.searchDocumentsPath}`,
JSON.stringify(allCoreContent(allBlogs))
JSON.stringify(allCoreContent(sortPosts(allBlogs)))
)
console.log('Local search index generated...')
}