mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-21 15:56:29 -05:00
🐷 Bug fix
This commit is contained in:
parent
9486b4044f
commit
872d813956
1 changed files with 1 additions and 3 deletions
|
@ -42,7 +42,6 @@ function search (query) {
|
|||
* Setup UI for Search
|
||||
*/
|
||||
function initUI () {
|
||||
|
||||
// Clear query when clear icon is clicked
|
||||
$('#searchBoxIcon').click(function () {
|
||||
$('#searchBox').val('')
|
||||
|
@ -101,7 +100,7 @@ function renderResults (results) {
|
|||
results.slice(0, MAX_PAGES).forEach(function (result, idx) {
|
||||
var $searchResultPage = $('<div class="searchResultPage">')
|
||||
var metadata = lunrResult[idx].matchData.metadata
|
||||
var matchPosition = metadata[Object.keys(metadata)[0]].body.position[0][0]
|
||||
var matchPosition = metadata[Object.keys(metadata)[0]].body ? metadata[Object.keys(metadata)[0]].body.position[0][0] : 0
|
||||
var bodyStartPosition = (matchPosition - (BODY_LENGTH / 2) > 0) ? matchPosition - (BODY_LENGTH / 2) : 0
|
||||
|
||||
$searchResultPage.append('<a class="searchResultTitle" href="' + result.ref + '">' + result.title + '</a>')
|
||||
|
@ -119,4 +118,3 @@ initLunr()
|
|||
$(function () {
|
||||
initUI()
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue