Closed zkrisj closed 5 months ago
https://vitepress.dev/reference/default-theme-search 按照这个操作就行了,就是加点配置的事 😊
https://vitepress.dev/reference/default-theme-search 按照这个操作就行了,就是加点配置的事 😊
好的,多谢了
import { defineConfig } from 'vitepress'
export default defineConfig({ themeConfig: { algolia: { appId: '48REP6ZA9O', apiKey: '3482029dd8400cbaa54eff5893aabb62', indexName: 'dev_zkrisj', } } }) 我这么配置了,怎么搜索都没有结果呢
https://vitepress.dev/reference/default-theme-search 按照这个操作就行了,就是加点配置的事 😊
ChatGPT给的建议:
这个是vitepress提供的集成能力,如果刚配置(配置正确)的话,可以等等看安是不是有类似“爬取”或者叫同步的时间
- Algolia
Algolia的配置需要去Algolia官网申请才能使用,在你的网站没有内容之前是不会通过的 想要使用搜索功能我建议使用本地搜索vitepress-plugin-search 过个一年半载,网站丰富了,再去申请Algolia 至于文档中的
search: {
provider: 'local'
}
我并没有在vitepress的接口中找到"search“,有理由怀疑是文档错误
- Algolia
Algolia的配置需要去Algolia官网申请才能使用,在你的网站没有内容之前是不会通过的 想要使用搜索功能我建议使用本地搜索vitepress-plugin-search 过个一年半载,网站丰富了,再去申请Algolia 至于文档中的
search: { provider: 'local' }
我并没有在vitepress的接口中找到"search“,有理由怀疑是文档错误
最新的版本或者或者说最近的刚加的本地搜索,我还没更新,不知道你看的是什么版本的代码,打算最近几天测试一下本地搜索更新一下。
官网的配置有点复杂,到第二步就不知道怎么弄了
- Algolia
Algolia的配置需要去Algolia官网申请才能使用,在你的网站没有内容之前是不会通过的 想要使用搜索功能我建议使用本地搜索vitepress-plugin-search 过个一年半载,网站丰富了,再去申请Algolia 至于文档中的
search: { provider: 'local' }
我并没有在vitepress的接口中找到"search“,有理由怀疑是文档错误
- Algolia
Algolia的配置需要去Algolia官网申请才能使用,在你的网站没有内容之前是不会通过的 想要使用搜索功能我建议使用本地搜索vitepress-plugin-search 过个一年半载,网站丰富了,再去申请Algolia 至于文档中的
search: { provider: 'local' }
我并没有在vitepress的接口中找到"search“,有理由怀疑是文档错误
我已经升级到1.0.0-alpha.74,provider: 'local'
已被支持,但不能识别中文。
这个自带的主题比vitepress-plugin-search的好看很多。
因为我没啥这种需求,就这样了,以后搞Algolia吧
Algolia 应该不复杂吧,回头我试一下哈
Algolia 应该不复杂吧,回头我试一下哈
👌好的
看了一下Algolia还是有点复杂,配置到vitepress很简单,麻烦的是总体Algolia是数据要上报到Algolia那才行,上报方式有: 1、主动上报json 2、在构建阶段上报,比如用的是git action的话相对就比较方便 3、用Algolia的爬虫爬(我一直以为这个是自动且免费的,结果这个是一个付费服务)
综述:直接用local方式的搜索可能更简单点了, vitepress版本有要求,官方一直在迭代这个功能。
ps: 用local search目前对文章中的 第一行内容(标题) 写成# {{ $frontmatter.title }}
这个有缺陷,很容易复现
https://vitepress.dev/reference/default-theme-search#algolia-search
非常感谢,我用了您的样式
因为我的文章比较多,想搜索某个文章的内容很麻烦,或者大佬给个文章搜索的实现方法