diff options
author | Fabrizio Ferri-Benedetti <algernon@gmail.com> | 2019-10-28 12:59:02 +0300 |
---|---|---|
committer | Fabrizio Ferri-Benedetti <algernon@gmail.com> | 2019-10-28 12:59:02 +0300 |
commit | 473d41d58310a9300dd00b6d2e2f8e62c5e1c753 (patch) | |
tree | 19d97fdf65439e72e520517f22bec346dde13e9a /static | |
parent | b6cd4e87e43291f03e723ffff9566831aae5e964 (diff) |
Fixes after review - single.html
Diffstat (limited to 'static')
-rw-r--r-- | static/js/offline-search.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/static/js/offline-search.js b/static/js/offline-search.js index d0a2481..b660ac2 100644 --- a/static/js/offline-search.js +++ b/static/js/offline-search.js @@ -19,7 +19,7 @@ $(window).on('load', function() { request.open("GET", "/index.json", true); // Request the JSON file created during build request.onload = function() { if (request.status >= 200 && request.status < 400) { - // Success response received in requesting the index.json file + // Success response received in requesting the search-index file var searchDocuments = JSON.parse(request.responseText); // Build the index so Lunr can search it. The `ref` field will hold the URL @@ -27,7 +27,6 @@ $(window).on('load', function() { idx = lunr(function lunrIndex() { this.ref('ref'); this.field('title'); - this.field('excerpt'); this.field('body'); // Loop through all the items in the JSON file and add them to the index @@ -78,7 +77,7 @@ function renderSearchResults(results) { results.forEach(function(result) { // Create result item var li = document.createElement('li'); - li.innerHTML = '<a href="' + result.ref + '">' + resultDetails[result.ref].title + '</a><br>' + resultDetails[result.ref].excerpt.substring(0,100) + '...'; + li.innerHTML = '<a href="' + result.ref + '">' + resultDetails[result.ref].title + '</a><br>' + resultDetails[result.ref].excerpt + '...'; ul.appendChild(li); }); |