mirror of
https://github.com/quartz-community/search.git
synced 2026-11-17 00:13:36 +00:00
Quartz's default search plugin.
- TypeScript 85.6%
- SCSS 14.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .changeset | ||
| .github/workflows | ||
| src | ||
| test | ||
| types | ||
| .eslintrc.json | ||
| .gitignore | ||
| .prettierignore | ||
| .prettierrc | ||
| CHANGELOG.md | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| vitest.config.ts | ||
@quartz-community/search
The Search component for Quartz - full-text search with FlexSearch integration.
Features
- 🔍 Full-Text Search - Search across all your content instantly
- ⚡ Fast Indexing - Uses FlexSearch for high-performance search
- 📱 Mobile Responsive - Works great on all devices
- 🎯 Search Preview - Optional content preview panel
- 🌐 Multi-Language - Supports 30+ locales
- ⌨️ Keyboard Shortcuts -
Ctrl/Cmd + Kto open,Escapeto close - 🏷️ Tag Search - Search by tags with special syntax
Installation
npx quartz plugin add @quartz-community/search
Search is already in Quartz's default configuration.
Usage
plugins:
- source: "@quartz-community/search"
enabled: true
options:
enablePreview: true
fieldPriority:
- title
- content
- tags
layout:
position: left
priority: 20
group: toolbar
groupOptions:
grow: true
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
enablePreview |
boolean |
true |
Show a preview of the selected result's content beside the list. |
fieldPriority |
Array<"title" | "content" | "tags"> |
["title", "content", "tags"] |
Order in which matches from each field are ranked. |
The placeholder and button text come from the site's locale.
Default Behavior
By default, the search component:
- Displays as a button with a search icon
- Opens a fullscreen search modal when clicked
- Shows the top 8 search results, each with up to 5 of its tags
- Shows a content preview beside the results on desktop (hidden below 800px; disable with
enablePreview: false) - Supports keyboard navigation (arrow keys, Tab, Enter, Escape)
How It Works
The Search component:
- Fetches content data via the
fetchDataglobal (resolvescontentIndex.jsonwith the correct base path) - Builds a search index from your content with FlexSearch (bundled with the plugin)
- Performs real-time search as you type
- Shows results with optional content preview
[!info] Search reads
contentIndex.json, which Quartz's built-in content index emits by default. It has nothing to search ifconfiguration.contentIndexis disabled inquartz.config.yaml.
Keyboard Shortcuts
Ctrl/Cmd + K- Open/Close searchCtrl/Cmd + Shift + K- Open search in tag mode (or start the query with#)Escape- Close searchArrow Up/Down,Tab/Shift + Tab- Navigate resultsEnter- Open selected result
Development
This is a first-party Quartz community plugin. It serves as both:
- A production-ready Search component
- A reference implementation for building Quartz community plugins
To build locally:
npm install
npm run build
Documentation
See the Quartz documentation for more information.
License
MIT