The official theme youlog integrates Algolia full-text search. The workflow is: export static site -> push index with ekmp-algolia -> configure everkm.yaml. See the youlog demo site for the result.
1. Prepare Algolia
Register on Algolia, create an index, and obtain:
- Application ID
- Admin API Key (for pushing the index)
- Search-Only API Key (for front-end search, safe to expose to the browser)
2. Install ekmp-algolia
pnpm add -D ekmp-algolia
CLI entry point: pnpm exec ekmp-algolia or ./node_modules/.bin/ekmp-algolia. Subcommands and options are documented in ekmp-algolia --help and ekmp-algolia walk --help.
Environment variables:
export ALGOLIA_APP_ID="Your Application ID"
export ALGOLIA_API_KEY="Your Admin API Key"
export EVERKM_LOG=info # Optional
3. Export and Push Index
everkm-publish serve --export
pnpm exec ekmp-algolia --index-name my-index reset \
--languages zh_CN --languages en_US \
--channel youlog --site my-site-id
pnpm exec ekmp-algolia --index-name my-index walk \
--url-base https://your-domain.com/ \
--dir dist \
--channel youlog --site my-site-id
| Step | Description |
|---|---|
reset | Writes index language, searchable fields settings (title, content, etc.) |
walk | Pushes HTML from local dist/ (recommended, no need to crawl the live site) |
crawl | Crawls and pushes from a deployed URL, see ekmp-algolia crawl --help |
For youlog multi-site scenarios: append --channel youlog --site <site-identifier> to reset / walk, matching the config.algolia_search.site value below.
4. Configure the Theme
Configure under config in __everkm/everkm.yaml (the youlog field name is algolia_search):
config:
algolia_search:
app_id: YOUR_APP_ID
api_key: YOUR_SEARCH_ONLY_API_KEY
index_name: my-index
site: my-site-id
| Field | Description |
|---|---|
app_id | Application ID |
api_key | Search-Only API Key |
index_name | Matches ekmp-algolia --index-name |
site | Site identifier, matches --site during push |
For more fields, see theme-youlog.
After saving, restart the preview; the top bar search box requires the theme to have built its search plugin assets.
CI Push
Inject environment variables through secrets; do not commit API keys to the repository:
export ALGOLIA_APP_ID="$ALGOLIA_APP_ID"
export ALGOLIA_API_KEY="$ALGOLIA_API_KEY"
pnpm exec ekmp-algolia --index-name my-index walk \
--url-base "$SITE_URL" --dir dist \
--channel youlog --site my-site-id