Bläddra i källkod

make less search indexes

zzossig 5 år sedan
förälder
incheckning
8cdd6df08e
2 ändrade filer med 4 tillägg och 7 borttagningar
  1. 0 3
      exampleSite/config/_default/config.toml
  2. 4 4
      layouts/partials/head/scripts.html

+ 0 - 3
exampleSite/config/_default/config.toml

@@ -33,10 +33,7 @@ disableKinds = ["taxonomyTerm"]
     startLevel = 2
 
 [outputs]
-  page = ["HTML", "SearchIndex"]
   home = ["HTML", "RSS", "SearchIndex"]
-  section = ["HTML", "RSS", "SearchIndex"]
-  taxonomy = ["HTML", "RSS", "SearchIndex"]
 
 [outputFormats]
   [outputFormats.SearchIndex]

+ 4 - 4
layouts/partials/head/scripts.html

@@ -452,12 +452,12 @@
         }
       });
     }) : null;
-  // ============================================================  
+  // ============================================================
 
 
   // ========================== search ==========================
-    {{ $permalink:= .Permalink }}
-    var permalink = JSON.parse({{ $permalink | jsonify }});
+    {{ $searchURL:= ("/" | absLangURL) }}
+    var searchURL = JSON.parse({{ $searchURL | jsonify }});
     var searchResults = null;
     var searchMenu = null;
     var searchText = null;
@@ -472,7 +472,7 @@
     if (enableSearch) {
       (function initFuse() {
         var xhr = new XMLHttpRequest();
-        xhr.open('GET', permalink + "index.json");
+        xhr.open('GET', searchURL + "index.json");
         xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
         xhr.onload = function () {
           if (xhr.status === 200) {