Search

Methanol provides an integrated static search solution powered by Pagefind. To maintain development efficiency, search functionality is disabled by default.

Search capabilities are exclusively available in production builds. The development server does not generate search indexes or serve the search UI.

Installation

Install Pagefind as a local development dependency:

npm i -D pagefind

Alternatively, it can be installed globally:

npm i -g pagefind

Enabling and Disabling

Configure the pagefind property within your methanol.config.* file:

// methanol.config.js
export default () => ({
	pagefind: true
})

To explicitly disable search:

// methanol.config.js
export default () => ({
	pagefind: false
})

Detailed Configuration

export default () => ({
	pagefind: {
		enabled: true,
		excerptLength: 30,
		build: {
			outputSubdir: 'pagefind',
			verbose: true
		}
	}
})

Properties other than enabled and build are passed directly to the Pagefind client-only UI initialization.

CLI Overrides

Search indexing can be toggled per-build via the CLI:

npx methanol build --search
npx methanol build --no-search

Custom Search Integrations

If you wish to utilize an alternative search provider:

  1. Disable the built-in Pagefind support (pagefind: false).
  2. Implement your own search UI and indexing workflow (e.g., via custom client components or external services).

The standard Methanol theme only renders the search UI when pagefind is enabled, providing a clean foundation for custom implementations.