Installation
Install the plugin using your preferred package manager:Quick Start
Add the Orama plugin to your.vitepress/config.js or .vitepress/config.ts file:
.vitepress/config.js
The plugin automatically replaces the default Vitepress search with Orama’s search interface.
Configuration
Basic Configuration
The plugin works out of the box with zero configuration:.vitepress/config.ts
With Analytics
Enable search analytics to track user queries:.vitepress/config.ts
Configuration Options
Enable and configure search analytics.
How It Works
The plugin automatically:- Scans Your Content: Reads all markdown files from your Vitepress site
- Parses Markdown: Converts markdown to HTML and extracts content
- Indexes Content: Creates an Orama search index with:
- Page titles
- Section headings
- Content text
- Page paths
- Bundles Index: Includes the search index in your build
- Replaces Search: Swaps the default search with Orama Searchbox
Index Schema
The plugin uses a predefined schema optimized for documentation:Search Features
The Orama Vitepress plugin provides:Full-Text Search
Search across all content including titles, headings, and body text
Section-Level Results
Results are organized by sections for precise navigation
Fuzzy Matching
Finds results even with typos or partial matches
Instant Results
Lightning-fast client-side search with no server required
Keyboard Navigation
Full keyboard support with shortcuts (⌘K or Ctrl+K)
Responsive Design
Works seamlessly on desktop and mobile devices
Search UI
The plugin uses the Orama Searchbox component, which provides:- Modal Interface: Opens in a modal overlay
- Live Results: Updates as you type
- Highlighted Matches: Shows matched terms in context
- Direct Navigation: Click results to navigate instantly
- Keyboard Shortcuts: Support for arrow keys, Enter, and Escape
Customization
The search UI automatically adapts to your Vitepress theme:.vitepress/config.ts
Build Process
During the build, the plugin:- Reads all markdown pages from your
docsdirectory - Parses frontmatter and content
- Extracts sections based on headings (h1-h6)
- Creates an Orama database instance
- Inserts all content into the database
- Persists the database to JSON format
- Includes it as a virtual module in the build
Virtual Module
The plugin creates a virtual modulevirtual:search-data that contains:
Content Processing
The plugin processes your content intelligently:Section Extraction
Content is split by headings to provide precise results:- “Getting Started” with intro content
- “Installation” with installation content
- “Configuration” with configuration content
Path Generation
Paths include anchors for direct navigation:Advanced Usage
Custom Base Path
If your site uses a custom base path:.vitepress/config.ts
base configuration.
Multi-Language Support
For multi-language sites:.vitepress/config.ts
Development
When developing locally:Production Build
For production builds:Performance
The plugin is optimized for performance:- Small Bundle Size: Minimal impact on your site’s bundle
- Fast Indexing: Efficient content processing during build
- Instant Search: Client-side search with no network latency
- Lazy Loading: Search components load on demand
The search index is compressed and loaded asynchronously, ensuring fast initial page loads.
Troubleshooting
Search not appearing
Search not appearing
Ensure you’re using the
vite.plugins configuration, not the vite property directly. The plugin must be added to the plugins array.Content not being indexed
Content not being indexed
Check that your markdown files are in the correct directory (typically
docs/ or the configured source directory). Verify that the files have actual content to index.Analytics not working
Analytics not working
Verify your analytics configuration:
enabledmust betrueapiKeymust be a valid Orama Cloud analytics keyindexIdmust match your Orama Cloud index
Build errors
Build errors
Make sure you have all peer dependencies installed:
Package Information
- Package Name:
@orama/plugin-vitepress - Version: 3.1.18
- License: Apache-2.0
- Repository: github.com/oramasearch/orama
Requirements
- Vitepress 1.x
- Vue ^3.0.0
- Node.js >= 16
Next Steps
Search Guide
Learn about search features
Core Database
Learn about the search engine
Analytics
Track search analytics
Full Documentation
View the complete guide