Skip to content

Node module for creating lunr.js search indexes for static Hugo sites

License

Notifications You must be signed in to change notification settings

gwleclerc/lunr-hugo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lunr-hugo

Generate lunr.js index files from Hugo static sites

A simple way to add site search to your static Hugo site using Lunr.js.

Installation

Install the lunr-hugo utility via npm:

$ npm install lunr-hugo

Options

By default lunr-hugo will read the content directory of you 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 lunr-hugo CLI

The easiest way to use lunr-hugo is via npm scripts:

  "scripts": {
    "index": "lunr-hugo"
  },

or to pass arguments for input and output:

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

Which can be executed from a terminal prompt

$ npm run index

How to use lunr-hugo API

var hugolunr = require('lunr-hugo');
new hugolunr().index();

or to set input/output paths

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

License

This project is a fork from https://github.com/dgrigg/hugo-lunr It is under ISC License. Check LICENSE.md for more information.

About

Node module for creating lunr.js search indexes for static Hugo sites

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%