https://github.com/status-im/hexo-elasticsearch
Document indexing in ElasticSearch for Hexo.
https://github.com/status-im/hexo-elasticsearch
elasticsearch hexo-plugin search-in-text static-site-generator
Last synced: 8 months ago
JSON representation
Document indexing in ElasticSearch for Hexo.
- Host: GitHub
- URL: https://github.com/status-im/hexo-elasticsearch
- Owner: status-im
- License: mit
- Created: 2018-11-30T14:38:32.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T15:06:49.000Z (over 3 years ago)
- Last Synced: 2025-02-22T17:43:24.652Z (8 months ago)
- Topics: elasticsearch, hexo-plugin, search-in-text, static-site-generator
- Language: JavaScript
- Size: 109 KB
- Stars: 2
- Watchers: 6
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Description
`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.
# Install
```bash
npm install --save https://github.com/status-im/hexo-elasticsearch.git
```# Configuration
The required configuration in `_config.yml` under `elasticsearch` keys is:
```yaml
elasticsearch:
index: 'dev.status.im'
esHost: 'search.status.im'
esPort: 443
```
And the required HTTP Auth env variables need to be provided to index:
```bash
export HEXO_ES_USER='es-user'
export HEXO_ES_PASS='super-secret-password'
```# Usage
Standard usage for indexing:
```bash
hexo elasticsearch
```
Dry Run:
```bash
hexo elasticsearch --dry-run
```
Delete index before upload:
```bash
hexo elasticsearch --delete
```# Helpers
If you want to start using the search you can use the two included helpers:
* `elasticsearch_config` - Adds neccessary `script` and `meta` tags with configuration from your `_config.yml`.
* `elasticsearch_script` - Adds the JS script which handles the given target tag to execute the query.## Example
```html
<%- elasticsearch_config() %>
<%- elasticsearch_script({target: "input#userSearch", size: 6}) %>
```