绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
Gitbook algolia
2022-06-02 09:59:20

https://github.com/GitbookIO/plugin-algolia

Power search using Algolia

Use Algolia as a back-end to index and search your book’s content.

This plugins requires gitbook >=4.0.0.

How to use it?

Create an Algolia account

  • Sign up to Algolia
  • Set up a basic index.
  • Access your API keys settings, and keep this page open for the next 
    steps.

Set up the plugin in your book. 
- Open Settings > Plugins Store interface in the GitBook Editor. 
- Install the algolia plugin. 
- Specify the following values in the modal for your book:

    Algolia Index Name, which is the name of the index you set up in Algolia web.
    Algolia Application ID, which is your unique application ID for API identification.
    Algolia Search-Only API Key, which is the unique ID for search queries.
    Is your Algolia account free, which you leave as true if you have what Algolia call a "Hacker Account".
  • 1
  • 2
  • 3
  • 4

Or if you prefer, you can declare the plug-in values in the book.json file. Add the plugin and its configuration to your book.json:

{
    "plugins": ["algolia"],
    "pluginsConfig": {
        "algolia": {
            "index": "algolia-index-name",
            "applicationID": "algolia-application-id",
            "publicKey": "algolia-search-only-api-key",
            "freeAccount": "true"
        }
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

Set Algolia Environment Variables

If you are using the GitBook Editor, you can specify the ALGOLIA_PRIVATEKEY in the Settings of your book.

  • Login to https://www.gitbook.com
  • Go to the Settings of the book you want to add the environment 
    variable to.
  • Scroll down to the Environment Variables group.
  • Add a new variable, named ALGOLIA_PRIVATEKEY, and put your Admin API 
    Key as value.

If you are using the command line, pass your Admin API Key as an environment variable when launching gitbook:

$ ALGOLIA_PRIVATEKEY="algolia-admin-api-key" gitbook serve
  • 1

  • 支持中文搜索
  • 断词很好
  • 免费账户基本够用
  • 还不确定在不的情况下能不能正常搜索
分享好友

分享这个小栈给你的朋友们,一起进步吧。

Algolia
创建时间:2022-04-27 15:22:58
Algolia
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

技术专家

查看更多
  • LCR_
    专家
戳我,来吐槽~