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) {