hexo-algolia
is an hexo plugin developed for internal use by Status.im.
This is what you get when you install it:
- A new command,
hexo elasticsearch
, to index the content of your website. - Two helpers:
- One for configuring destination for queries.
- One for including a search JS script for handling input.
The hexo algolia command can be run manually on your computer and on a continuous integration system.
npm install --save https://github.com/status-im/hexo-elasticsearch.git
The required configuration in _config.yml
under elasticsearch
keys is:
elasticsearch:
index: 'dev.status.im'
esHost: 'search.status.im'
esPort: 443
And the required HTTP Auth env variables need to be provided to index:
export HEXO_ES_USER='es-user'
export HEXO_ES_PASS='super-secret-password'
Standard usage for indexing:
hexo elasticsearch
Dry Run:
hexo elasticsearch --dry-run
Delete index before upload:
hexo elasticsearch --delete
If you want to start using the search you can use the two included helpers:
elasticsearch_config
- Adds neccessaryscript
andmeta
tags with configuration from your_config.yml
.elasticsearch_script
- Adds the JS script which handles the given target tag to execute the query.
<html>
<head>
<meta charset="utf-8">
<%- elasticsearch_config() %>
</head>
<body>
<input type="text" id="userSearch" placeholder="Search...">
<%- elasticsearch_script({target: "input#userSearch", size: 6}) %>
</body>
<html>