Search Index .json-file for Lunr.js

OK, so I couldn’t wait. Assuming you’ve got Lunr.js working well (see here, or perhaps here), here’s a quick and dirty copy of @bep’s code:

Create /content/search-index.md, fill it with:

+++
date = "2017-03-05T21:10:52+01:00"
type = "json"
url = "index.json"

+++
```
(bep shows another way of writing above code in the link I posted at the top).

I keep all layout files in my themes folders so then i created a file with the path `themes/THEME/layouts/json/single.html`

Then filled it with
```
{{- $.Scratch.Add "index" slice -}}
{{- range where .Site.Pages "Type" "not in"  (slice "page" "json") -}}
{{- $.Scratch.Add "index" (dict "title" .Title "href" .Permalink "tags" .Params.tags "content" .Plain) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
```
Json file then reachable through `/index.json`. Hope it helps!