Search and Comments

Search and comments are both site-level integrations: fill in a set of credentials in the site config, the build layer writes them into the page payload, and the theme chrome and islands mount the corresponding components on the client. Markdown content plays no part.

Algolia DocSearch

ts
algolia: {
  appId: 'XXX',
  apiKey: 'XXX',       // search-only key, safe to expose
  indexName: 'xxx',
}

When configured, the navbar mounts a DocSearch box (the credentials ship with the payload; a search-only key is public by design). Three steps to wire it up:

  1. Apply at DocSearch or create an index yourself in the Algolia console to get the three credentials; when the application review asks to verify site ownership, add the verification meta Algolia gives you through the head config (see configuration)
  2. Fill them into the algolia field of the site config
  3. Run one full re-crawl: the CSS selectors in the crawler config must match the new theme's DOM structure (content container, heading levels); selectors from an old site do not adapt automatically

The search box styling already follows light/dark; the style entry is src/client/theme/docsearch.css.

Giscus comments

giscus builds on GitHub Discussions and is the framework's built-in comment option. After picking a repo and category in the giscus.app wizard, fill the four generated values into the config:

ts
giscus: {
  repo: 'owner/repo',           // public repo
  repoId: 'R_xxx',              // generated by the wizard
  category: 'General',          // Discussions category name
  categoryId: 'DIC_xxx',        // generated by the wizard
}

Behavior notes:

Selection advice

This site has both configured: the search box in the navbar and the comment section at the bottom of any article are live — try them. The credentials are the two value sets in this repo's vite.config.ts.