From 6757d0f3b1f5a08aff8a4592720e4c3e38b91dc2 Mon Sep 17 00:00:00 2001 From: zzossig Date: Wed, 1 Jul 2020 06:00:37 +0900 Subject: [PATCH] [bug fix] publication search fixed where the search index couldn't be found --- layouts/partials/head/scripts.html | 11 +++++++++-- 1 file 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) {