Add the search page
This commit is contained in:
parent
ac474ceccc
commit
db577a69ea
|
@ -0,0 +1,6 @@
|
||||||
|
build:
|
||||||
|
hugo -D
|
||||||
|
npm run index
|
||||||
|
clean:
|
||||||
|
rm -rf public
|
||||||
|
rm -v $(shell find . -iname "*~")
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: "Search"
|
||||||
|
layout: "search"
|
||||||
|
---
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"index": "hugo-lunr"
|
"index": "mkdir -p public/db && hugo-lunr -i 'content/**' -o public/db/db.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hugo-lunr": "^0.0.4"
|
"hugo-lunr": "^0.0.4"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
et fuse
|
let fuse
|
||||||
const fuseOptions = {
|
const fuseOptions = {
|
||||||
shouldSort: true,
|
shouldSort: true,
|
||||||
includeMatches: true,
|
includeMatches: true,
|
||||||
|
@ -17,8 +17,7 @@ const fuseOptions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
console.log("dvfdj")
|
fetch('/db/db.json')
|
||||||
fetch('/index.json')
|
|
||||||
.then(resp => resp.json())
|
.then(resp => resp.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
fuse = new Fuse(data, fuseOptions)
|
fuse = new Fuse(data, fuseOptions)
|
||||||
|
|
Loading…
Reference in New Issue