Skip to content

Search

JustDocs includes a powerful search system to help users find content quickly.

Features

The search box is always available in the header:

  • Keyboard shortcut: ⌘K (Mac) or Ctrl+K (Windows/Linux)
  • Live results: See results as you type
  • Keyboard navigation: Use arrow keys to navigate results
  • Categories: Results grouped by documentation section

Configuration

Basic Setup

Search is enabled by default. No configuration needed!

Custom Search Provider

Integrate with external search services:

search: {
  provider: 'algolia',
  appId: 'YOUR_APP_ID',
  apiKey: 'YOUR_API_KEY',
  indexName: 'docs'
}

Search Providers

Algolia

Popular hosted search service:

npm install @algolia/client-search
import algoliasearch from '@algolia/client-search';

const client = algoliasearch('APP_ID', 'API_KEY');
const index = client.initIndex('docs');

Pagefind

Static search for Astro:

npm install pagefind

Add to build:

"scripts": {
  "build": "astro build && pagefind --source dist"
}

Implement your own search:

search: {
  provider: 'custom',
  endpoint: '/api/search'
}

Indexing

What Gets Indexed

By default, these elements are indexed:

  • Page titles
  • Headings (H2, H3, H4)
  • Paragraph text
  • Code block titles

Prevent content from being indexed:

---
searchable: false
---

Keyboard Shortcuts

Default Shortcuts

  • ⌘K / Ctrl+K: Open search
  • Escape: Close search
  • : Navigate results
  • Enter: Go to selected result

Custom Shortcuts

Configure custom keyboard shortcuts:

search: {
  shortcuts: {
    open: ['/', 'command+k', 'ctrl+k']
  }
}

Search Analytics

Track search queries to improve documentation:

search: {
  analytics: {
    provider: 'google',
    trackingId: 'UA-XXXXX-Y'
  }
}