Fix 'undefined' href in search results without highlight
If enableSearchHighlight = false is set in params.toml, populated search results will use the makeLi function to set href to obj.item.permalink as opposed to obj.item.uri when the makeHighlightLi function is used. obj.item.permalink used will result in undefined attribute and invalid links.
This commit is contained in:
parent
e43a7c1aec
commit
51eb84391b
|
@ -722,7 +722,7 @@
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
a.innerHTML = obj.item.title;
|
a.innerHTML = obj.item.title;
|
||||||
a.setAttribute('class', 'search-result__item--title');
|
a.setAttribute('class', 'search-result__item--title');
|
||||||
a.setAttribute('href', obj.item.permalink);
|
a.setAttribute('href', obj.item.uri);
|
||||||
|
|
||||||
var descDiv = document.createElement('div');
|
var descDiv = document.createElement('div');
|
||||||
descDiv.setAttribute('class', 'search-result__item--desc');
|
descDiv.setAttribute('class', 'search-result__item--desc');
|
||||||
|
@ -1322,4 +1322,4 @@
|
||||||
}
|
}
|
||||||
// ============================================================
|
// ============================================================
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue