Quartz's default search plugin.
  • TypeScript 85.6%
  • SCSS 14.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-09 23:04:48 +01:00
.changeset chore: version package 2026-11-09 04:09:36 +00:00
.github/workflows ci: run ci.yml on the changesets version PR and report it as a commit status 2026-11-09 03:47:26 +01:00
src fix: use SPA navigation for Enter key instead of full page reload 2026-05-24 17:22:52 +02:00
test fix: resolve CI failures by fixing lint config and test setup 2026-02-09 12:58:51 +01:00
types fix: use fetchData global for path-prefixed deployments 2026-03-16 18:54:25 +01:00
.eslintrc.json fix: use fetchData global for path-prefixed deployments 2026-03-16 18:54:25 +01:00
.gitignore chore: migrate to npm publishing 2026-07-23 09:07:40 +02:00
.prettierignore fix: use fetchData global for path-prefixed deployments 2026-03-16 18:54:25 +01:00
.prettierrc Initial commit 2026-02-07 07:31:38 +01:00
CHANGELOG.md chore: version package 2026-11-09 04:09:36 +00:00
LICENSE Initial commit 2026-02-07 07:31:38 +01:00
package-lock.json chore: version package 2026-11-09 04:09:36 +00:00
package.json chore: version package 2026-11-09 04:09:36 +00:00
README.md docs(readme): Quartz 5.1 — npm install and config, correct options and defaults 2026-11-09 22:57:50 +01:00
tsconfig.build.json fix: use separate tsconfig for DTS build to avoid vitest dependency 2026-03-22 13:12:01 +01:00
tsconfig.json fix: use fetchData global for path-prefixed deployments 2026-03-16 18:54:25 +01:00
tsup.config.ts build: keep preact and the other shared packages external (tsup's noExternal overrode them) 2026-11-09 04:49:40 +01:00
vitest.config.ts fix: resolve CI failures by fixing lint config and test setup 2026-02-09 12:58:51 +01:00

@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 + K to open, Escape to 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:

  1. Fetches content data via the fetchData global (resolves contentIndex.json with the correct base path)
  2. Builds a search index from your content with FlexSearch (bundled with the plugin)
  3. Performs real-time search as you type
  4. 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 if configuration.contentIndex is disabled in quartz.config.yaml.

Keyboard Shortcuts

  • Ctrl/Cmd + K - Open/Close search
  • Ctrl/Cmd + Shift + K - Open search in tag mode (or start the query with #)
  • Escape - Close search
  • Arrow Up/Down, Tab/Shift + Tab - Navigate results
  • Enter - Open selected result

Development

This is a first-party Quartz community plugin. It serves as both:

  1. A production-ready Search component
  2. 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