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

github.com/zzossig/hugo-theme-zzo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzossig <zzossig@gmail.com>2020-07-01 00:00:37 +0300
committerzzossig <zzossig@gmail.com>2020-07-01 00:00:37 +0300
commit6757d0f3b1f5a08aff8a4592720e4c3e38b91dc2 (patch)
tree795fbec1e5cd1f1ca0e8f02688f52e19c280eb07
parent6229f7fe2040f107b6365129838b03296a4439bd (diff)
[bug fix] publication search
fixed where the search index couldn't be found
-rw-r--r--layouts/partials/head/scripts.html11
1 files changed, 9 insertions, 2 deletions
diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html
index a42727a..3b9556a 100644
--- a/layouts/partials/head/scripts.html
+++ b/layouts/partials/head/scripts.html
@@ -571,13 +571,20 @@
var searchResultPosition = JSON.parse({{ $searchResultPosition | jsonify }});
{{ $sectionType := .Type }}
var sectionType = JSON.parse({{ $sectionType | jsonify }});
-
+ {{ $kind := .Kind }}
+ var kind = JSON.parse({{ $kind | jsonify }});
+
var fuse = null;
if (enableSearch) {
(function initFuse() {
var xhr = new XMLHttpRequest();
- xhr.open('GET', baseurl + langprefix + "/index.json");
+ if (sectionType === "publication" && kind !== "page") {
+ xhr.open('GET', permalink + "index.json");
+ } else {
+ xhr.open('GET', baseurl + langprefix + "/index.json");
+ }
+
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhr.onload = function () {
if (xhr.status === 200) {