Skip to content

gethinode/mod-flexsearch

Repository files navigation

Hinode Module - FlexSearch

A Hugo module to add full text search powered by FlexSearch to your Hinode site

About

Logo

Hinode is a clean blog theme for Hugo, an open-source static site generator. Hinode is available as a template, and a main theme. This repository maintains a Hugo module to add FlexSearch to a Hinode site. Visit the Hinode documentation site for installation instructions.

Contributing

This module uses semantic-release to automate the release of new versions. The package uses husky and commitlint to ensure commit messages adhere to the Conventional Commits specification. You can run npx git-cz from the terminal to help prepare the commit message.

Configuration

This module supports the following parameters (see the section params.modules in config.toml):

Setting Default Description
flexsearch.canonifyURLs false If set, uses absolute URLs for the indexed pages instead of relative URLs.
flexsearch.frontmatter false If set, includes front matter in the page content. The search index function adds all parameters with the name content, heading, title, preheading recursively.
flexsearch.filter "params" Restricts the scanned frontmatter variables to the named filter. By default, all front matter variables are scanned. Only applicable when flexsearch.frontmatter is set.
flexsearch.summaryOnly false If set, indexes each page's summary instead of its full content. Reduces the size of the generated search index considerably on large sites, at the cost of matching only summary text.
flexsearch.lazyLoad false If set, the search index is emitted as a separate per-language JSON file and fetched on the visitor's first search interaction, instead of being bundled into the core script loaded on every page. See the note below on Content Security Policy.

Note

With flexsearch.lazyLoad enabled the search index is fetched at runtime. A site that sets a strict Content Security Policy must allow connect-src 'self'. The module declares this directive in its csp block, so sites using the Hinode CSP module pick it up automatically.

In addition, the module recognizes the following site parameters (see the section params.navigation in config.toml):.

Setting Default Description
search.enabled false If set, enables search in the site's main navigation.
search.modal false If set, uses a modal form for search queries. Defaults to an embedded input field.

The icon used by modal search is read from the central [icons] section in params.toml:

Setting Default Description
icons.search fas magnifying-glass Defines the icon used in the site's main navigation. Only applicable to modal search.

Note

The legacy navigation.search.icon parameter was deprecated in v3.3.0 in favour of icons.search. It still works but emits a deprecation warning; migrate any existing configuration to the [icons] section.

About

A Hugo module to add full text search powered by FlexSearch to your Hinode site

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Generated from gethinode/mod-template