Skip to content

Commit

Permalink
TRG-128: Ensure http_prefix is not duplicated when generating search …
Browse files Browse the repository at this point in the history
…result links.
  • Loading branch information
eddgrant committed Feb 3, 2022
1 parent 7ccde80 commit babdeb7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/assets/javascripts/_modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@
var content = s.processContent(result.content, query)
output += '<li class="search-result">'
output += '<h3 class="search-result__title">'
var url = result.url.startsWith('/') ? result.url.slice(1) : result.url
output += '<a href="' + pathToSiteRoot + url + '">'
var pagePathWithoutLeadingSlash = result.url.startsWith('/') ? result.url.slice(1) : result.url
var url = pathToSiteRoot.startsWith('.') ? pathToSiteRoot + pagePathWithoutLeadingSlash : '/' + pagePathWithoutLeadingSlash
output += '<a href="' + url + '">'
output += result.title
output += '</a>'
output += '</h3>'
Expand Down

0 comments on commit babdeb7

Please sign in to comment.