Create a new page based on search
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-05-24 00:59:04 +02:00
parent 38764b278a
commit f96bf8e8f8
2 changed files with 3 additions and 1 deletions

View File

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

View File

@ -259,6 +259,7 @@
[[#results]]
<li><a href="/[[ref]]">[[title]]</a></li>
[[/results]]
<ll><a href="/edit/[[page]]">Create a page</a></ll>
</ul>
</div>
</body>