vitepress-plugin-moss package. The plugin automatically indexes your content at build time and replaces the default search with a fast, semantic search interface powered by Moss.
Note: For the full plugin source and a demo site, see the vitepress-plugin-moss package.
Why use Moss with VitePress?
VitePress’s built-in search relies on keyword matching, which misses results when users phrase queries differently than the docs. Moss semantic search understands meaning, so users find what they need even when their wording doesn’t match the docs exactly. Queries run in under 10ms once the local index loads.Required tools
Integration guide
Configure VitePress
Add the Moss plugin and search options to your VitePress config.
docs/.vitepress/config.ts
How it works
The plugin uses a two-phase search architecture:- Cloud hot-path — From the first keystroke, queries route to Moss cloud for instant results.
- Local WebAssembly — In the background, the local model and index download in parallel. Once ready, queries switch to sub-10ms on-device search automatically.
Excluding pages
Addsearch: false to a page’s frontmatter to exclude it from the index.
Configuration
Search options
All options go underthemeConfig.search.options in your VitePress config.
| Parameter | Type | Default | Description |
|---|---|---|---|
projectId | string | Required | Your Moss Project ID. |
projectKey | string | Required | Your Moss Project Key. |
indexName | string | Required | Name of the index to create on every build. |
topK | number | 10 | Number of results to return. |
placeholder | string | "Search docs..." | Search input placeholder text. |
buttonText | string | "Search" | Nav bar search button label. |
Keyboard shortcuts
| Key | Action |
|---|---|
Ctrl+K / Cmd+K | Open or close search |
/ | Open search (when not focused on an input) |
Up / Down | Navigate results |
Enter | Go to selected result |
Esc | Close search |