Embedded Search

2026-06-19

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
StepDescription
resetWrites index language, searchable fields settings (title, content, etc.)
walkPushes HTML from local dist/ (recommended, no need to crawl the live site)
crawlCrawls 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
FieldDescription
app_idApplication ID
api_keySearch-Only API Key
index_nameMatches ekmp-algolia --index-name
siteSite 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