From f96bf8e8f8aa742f3a97efd768924f1cdca5bc15 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sun, 24 May 2020 00:59:04 +0200 Subject: [PATCH] Create a new page based on search --- editor/src/index.js | 3 ++- templates/layout.html | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/src/index.js b/editor/src/index.js index f5272d9..abf5255 100644 --- a/editor/src/index.js +++ b/editor/src/index.js @@ -111,8 +111,9 @@ search(searchInput).then(searcher => { } $('#autocomplete').show() let result = searcher.search(query) + const newpage = query.replace(' ', '_') var template = document.getElementById('result-template').innerHTML; - var rendered = Mustache.render(template, {results: result}, {}, ['[[', ']]']); + var rendered = Mustache.render(template, {page: newpage, results: result}, {}, ['[[', ']]']); let autocomplete = document.getElementById('autocomplete'); autocomplete.innerHTML = rendered; }, 500) diff --git a/templates/layout.html b/templates/layout.html index 04fef50..f2bc2a9 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -259,6 +259,7 @@ [[#results]]
  • [[title]]
  • [[/results]] + Create a page