Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matsuyoshi30/harbor.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatsuyoshi <sfbgwm30@gmail.com>2021-10-23 19:01:49 +0300
committermatsuyoshi <sfbgwm30@gmail.com>2021-10-23 19:01:49 +0300
commitcf57c0b9af813fadb3c4362d5a4f2bc50b8cc3f4 (patch)
tree23ed9c87a31221d1b77f53fdd5744be5382712cb /layouts
parent16b0a4e50730e93723589afc5963522138855110 (diff)
replace lunr with flexsearch
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.json15
-rw-r--r--layouts/partials/head.html7
2 files changed, 6 insertions, 16 deletions
diff --git a/layouts/_default/list.json b/layouts/_default/list.json
deleted file mode 100644
index 618a67a..0000000
--- a/layouts/_default/list.json
+++ /dev/null
@@ -1,15 +0,0 @@
-[
- {{ range $index, $page := .Pages }}
- {{ if eq .Type "post" }}
- {{ if ne $index 0 }},{{ end }}
- {
- "id": $index,
- "ref": "{{ $page.Permalink }}",
- "title": {{ $page.Title | jsonify }},
- "section": "{{ $page.Section }}",
- "date" : {{ $page.Date.Format "2006.01.02" | jsonify }},
- "body": {{ $page.Plain | jsonify }}
- }
- {{ end }}
- {{ end }}
-]
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 7507d7e..9b15997 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -66,10 +66,15 @@
<script defer crossorigin="anonymous" src="{{ $instantpage.RelPermalink }}" integrity="{{ $instantpage.Data.Integrity }}"></script>
{{- if (eq .Layout `search`) -}}
+ {{ $flexsearch := resources.Get "js/flexsearch.bundle.js" }}
+ <script defer crossorigin="anonymous" src="{{ $flexsearch.RelPermalink }}" integrity="{{ $flexsearch.Data.Integrity }}"></script>
+
{{ $lunr := resources.Get "js/lunr.min.js" }}
{{ $mark := resources.Get "js/mark.min.js" }}
{{ $basesearch := resources.Get "js/search.js" }}
- {{ $search := (slice $lunr $mark $basesearch) | resources.Concat "js/search.js" | minify }}
+
+ {{ $searchJSFile := printf "js/%s.search.js" .Language.Lang }}
+ {{ $search := (slice $lunr $mark $basesearch) | resources.Concat "js/search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Fingerprint }}
<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script>
{{- end -}}