vitepress 文档搜索处理

315 天前
 jjnox

但是我在 algolia 可以搜索到

    search: {
      provider: 'algolia',
      options: {
        appId: 'PBT33QQIUI',
        apiKey: 'f89129281b57349f1db1d2fa0fa652df',
        indexName: 'netlify_e683bb75-c0ba-4f7a-8bda-72bc295403d0_main_all',
      },
    },

有什么错误么?

发现也有 log 啊,就是undefined

1577 次点击
所在节点    Node.js
7 条回复
Alkaidcc
314 天前
algolia 不行的话可以换 local search 试试,https://vitepress.dev/reference/default-theme-search#local-search
ourongxing
314 天前
把 lang 这段加上去
```json
"selectors": {
"lvl0": "",
"lvl1": ".content h1",
"lvl2": ".content h2",
"lvl3": ".content h3",
"lvl4": ".content h4",
"lvl5": ".content h5",
"content": ".content p, .content li",
"lang": {
"selector": "/html/@lang",
"type": "xpath",
"global": true
}
},
```
jjnox
314 天前
@ourongxing 写在何处?
ourongxing
314 天前
@jjnox 爬虫配置文件啊,你这难道是 algolia 自动爬的。
jjnox
314 天前
@ourongxing 对啊,部署在 netlify ,有插件,自动爬的,就是前端无法显示啊,只出来`underfined`
jjnox
313 天前
@jjnox 现在用 docker 自己跑,

```bash
docker run -it --rm --env-file=/share/Docker/algolia/.env.valorant -e "CONFIG=$(cat /share/Docker/algolia/valorant.json | jq -r tostring)" algolia/docsearch-scraper
```

文档 vitepress 版本

```
"vitepress": "1.0.0-beta.1"
```

valorant.json 配置该怎么写
jjnox
313 天前
@ourongxing ok 了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/953526

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX