diff options
author | rainbowpigeon <16717153+rainbowpigeon@users.noreply.github.com> | 2021-05-03 12:29:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 12:29:31 +0300 |
commit | 51eb84391b55c123cc64b3812b620e53fa6d4bbb (patch) | |
tree | 11b51fbcf7480e543748859926a1d86518f297c8 | |
parent | e43a7c1aeca5d0dccb35ee394d127e89d08bc1bc (diff) |
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.
-rw-r--r-- | layouts/partials/head/scripts.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html index 3f0ba08..dba8cde 100644 --- a/layouts/partials/head/scripts.html +++ b/layouts/partials/head/scripts.html @@ -722,7 +722,7 @@ var a = document.createElement('a'); a.innerHTML = obj.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'); descDiv.setAttribute('class', 'search-result__item--desc'); @@ -1322,4 +1322,4 @@ } // ============================================================ }); -</script>
\ No newline at end of file +</script> |