# hugo-lunr

> Generate lunr.js index files for Hugo static site search

Latest version **0.0.4** (published 2016-02-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install hugo-lunr
pnpm add hugo-lunr
yarn add hugo-lunr
bun add hugo-lunr
```

Provides the command `hugo-lunr`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2016-02-16 |
| First published | 2016-02-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 71 |
| Author | Derrick Grigg |
| Maintainers | dgrigg |
| Keywords | hugo, lunr, static, site, search |

## Links

- npm: https://www.npmjs.com/package/hugo-lunr
- Repository: https://github.com/dgrigg/hugo-lunr
- Issues: https://github.com/dgrigg/hugo-lunr/issues
- npm.io page: https://npm.io/package/hugo-lunr

## Dependencies (5)

- [glob](https://npm.io/package/glob.md) ^7.0.0
- [toml](https://npm.io/package/toml.md) ^2.3.0
- [striptags](https://npm.io/package/striptags.md) ^2.1.1
- [gray-matter](https://npm.io/package/gray-matter.md) ^2.0.2
- [remove-markdown](https://npm.io/package/remove-markdown.md) ^0.1.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2016-02-16
- 0.0.3 — 2016-02-16
- 0.0.2 — 2016-02-16
- 0.0.1 — 2016-02-16

## README

# hugo-lunr
## Generate lunr.js index files from Hugo static sites
A simple way to add site search to your static [Hugo](https://gohugo.io/) site using [Lunr.js](http://lunrjs.com/). Hugo-lunr will create an index file of any html and markdown documents in your Hugo project, only non-draft documents get added to the index.

## Installation

Install the hugo-lunr utility via [npm](http://npmjs.org/):

```
$ npm install hugo-lunr
```

## Options
By default hugo-lunr will read the `content` directory of your Hugo project and output the lunr index to `public/lunr.json`. If you are using the command line implementation you can pass an input directory `-i` and and output path/file `-o`.

## How to use hugo-lunr CLI
The easiest way to use hugo-lunr is via npm scripts:
```
  "scripts": {
    "index": "hugo-lunr"
  },
```

or to pass arguments for input and output:

```
  "scripts": {
    "index": "hugo-lunr -i \"content/subdir/**\" -o public/my-index.json"
  },
```

Which can be executed from a terminal prompt
```
$ npm run index
```

## How to use hugo-lunr API
```javascript
var hugolunr = require('hugo-lunr');
new hugolunr().index();
```

or to set input/output paths

```javascript
var hugolunr = require('hugo-lunr');
var h = new hugolunr();
h.setInput('content/faq/**');
h.setOutput('public/faq.json');
h.index();
```

## How to use Lunr.jr
Checkout this [example page](http://lunrjs.com/example/) to see how to setup search using lunr.js on your website.

---
_Source: https://npm.io/package/hugo-lunr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
