Add the search page

This commit is contained in:
Sameer Rahmani 2022-10-09 19:14:56 +01:00
parent ac474ceccc
commit db577a69ea
4 changed files with 13 additions and 4 deletions

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
build:
hugo -D
npm run index
clean:
rm -rf public
rm -v $(shell find . -iname "*~")

4
content/search.md Normal file
View File

@ -0,0 +1,4 @@
---
title: "Search"
layout: "search"
---

View File

@ -1,6 +1,6 @@
{
"scripts": {
"index": "hugo-lunr"
"index": "mkdir -p public/db && hugo-lunr -i 'content/**' -o public/db/db.json"
},
"dependencies": {
"hugo-lunr": "^0.0.4"

View File

@ -1,4 +1,4 @@
et fuse
let fuse
const fuseOptions = {
shouldSort: true,
includeMatches: true,
@ -17,8 +17,7 @@ const fuseOptions = {
}
window.onload = function () {
console.log("dvfdj")
fetch('/index.json')
fetch('/db/db.json')
.then(resp => resp.json())
.then(data => {
fuse = new Fuse(data, fuseOptions)