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:
rainbowpigeon 2021-05-03 17:29:31 +08:00 committed by GitHub
parent e43a7c1aec
commit 51eb84391b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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');