The meaning of life is to explore the world

Algolia implementation

Posted on By Jason Liu

How to install Algolia and push content?
https://community.algolia.com/jekyll-algolia/getting-started.html

How to imlement Algolia search in your website?
https://community.algolia.com/jekyll-algolia/blog.html

Key words:
Application name: ****
Index name: ****
Admin API key: ****

Note:

  1. Below commands doesn’t work under Windows
    ALGOLIA_API_KEY='saldfjpwoeifjlsdfjkoweifj9837592' bundle exec jekyll algolia
    'ALGOLIA_API_KEY' is not recognized as an internal or external command,
    
  2. “jekyll algolia” doesn’t support Chinese under Windows coz cmd is not UTF-8 by default.
    Error message:
    Updating settings of index jekyll
    jekyll 4.0.0 | Error:  invalid byte sequence in GBK
    

    FYI, running in a start temp.bat doesn’t work either, and running in Powershell doesn’t work either

  3. Below commands works
:: There is no quotation mark while setting Windows environment variable
set ALGOLIA_API_KEY=saldfjpwoeifjlsdfjkoweifj9837592
:: Change Code Page in command prompt to UTF-8
chcp 65001
:: Wait for the finish of pushing to Algolia 
start /WAIT bundle exec jekyll algolia
:: Change Code Page in command prompt back to ANSI Chinese GB2312
chcp 936

Configuration file: D:/JekyllBlog/myblog/_config.yml
Processing site...
Rendering to HTML (100%) |=====================================================|
Extracting records (100%) |====================================================|
Settings are already up to date.
Getting list of existing records
Content is already up to date.
? Indexing complete