Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/clarketm/hugo-lunr-indexer

Generate Lunr indexes for Hugo static sites by parsing front matter
https://github.com/clarketm/hugo-lunr-indexer

hugo index indexer indexing indexing-engine lunr toml yaml

Last synced: 3 months ago
JSON representation

Generate Lunr indexes for Hugo static sites by parsing front matter

Awesome Lists containing this project

README

        

# [Hugo-Lunr-Indexer (HLI)](https://blog.travismclarke.com/project/hugo-lunr-indexer/)

[![NPM release](https://img.shields.io/npm/v/hugo-lunr-indexer.svg)](https://www.npmjs.com/package/hugo-lunr-indexer)
[![Build Status](https://circleci.com/gh/clarketm/hugo-lunr-indexer.svg?style=shield)](https://circleci.com/gh/clarketm/hugo-lunr-indexer)
[![License](https://img.shields.io/npm/l/hugo-lunr-indexer.svg)](LICENSE.md)

Generate [Lunr](https://lunrjs.com/) indexes for [Hugo](https://gohugo.io/) static sites by parsing front matter.







## Installation

#### Install with npm

```shell
$ npm install hugo-lunr-indexer
```

## Usage

#### CLI

```shell
###################
# Default options #
###################

$ hli \ # hli -> hugo-lunr-indexer
-i "content/**" \ # input (path)
-o "public/lunr.json" \ # output (path)
-l "toml" # language (toml | yaml)
-d "+++" # delimiter (toml: +++ | yaml: ---)
```

#### NPM Scripts

```javascript
...
"scripts": {
"index": "hli -i 'content/posts/**' -o 'public/indices/lunr.json' -l 'yaml' -d '---'"
},
...
```

```shell
$ npm run index
```

#### API

```javascript
var hli = require('hugo-lunr-indexer');
var Indexer = new hli();
Indexer.setInput('content/blog/**');
Indexer.setOutput('public/static/index.json');
Indexer.setLanguage('toml');
Indexer.setDelimiter('---');
Indexer.index();
```

## Sites using hugo-lunr-indexer
* https://blog.travismclarke.com/

## License
Apache-2.0 © [Travis Clarke](https://www.travismclarke.com/)