diff --git a/layouts/index.json b/layouts/index.json
index 367f3b3185..e975d70c43 100644
--- a/layouts/index.json
+++ b/layouts/index.json
@@ -2,7 +2,7 @@
{{- if ne $page.Type "json" -}}
{{- if and $index (gt $index 0) -}},{{- end }}
{
- "uri": "{{ $page.Permalink }}",
+ "uri": "{{ $page.RelPermalink }}",
"title": "{{ htmlEscape $page.Title}}",
"tags": [{{ range $tindex, $tag := $page.Params.tags }}{{ if $tindex }}, {{ end }}"{{ $tag| htmlEscape }}"{{ end }}],
"description": "{{ htmlEscape .Description}}",
diff --git a/layouts/partials/search.html b/layouts/partials/search.html
index 41daf84b9c..bfc2b88d94 100644
--- a/layouts/partials/search.html
+++ b/layouts/partials/search.html
@@ -7,10 +7,10 @@
diff --git a/static/js/search.js b/static/js/search.js
index 3189705e08..841fc6b888 100644
--- a/static/js/search.js
+++ b/static/js/search.js
@@ -6,12 +6,8 @@ function endsWith(str, suffix) {
// Initialize lunrjs using our generated index file
function initLunr() {
- if (!endsWith(baseurl,"/")){
- baseurl = baseurl+'/'
- };
-
// First retrieve the index file
- $.getJSON(baseurl +"index.json")
+ $.getJSON(index_url)
.done(function(index) {
pagesIndex = index;
// Set up lunrjs by declaring the fields we use
@@ -82,7 +78,7 @@ $( document ).ready(function() {
divsuggestion.className = "autocomplete-suggestion";
divsuggestion.setAttribute("data-term", term);
divsuggestion.setAttribute("data-title", item.title);
- divsuggestion.setAttribute("data-uri", item.uri);
+ divsuggestion.setAttribute("data-uri", baseUri + item.uri);
divsuggestion.setAttribute("data-context", item.context);
divsuggestion.innerText = 'ยป ' + item.title;
divsuggestion.appendChild(divcontext);